Skip to content

Commit

Permalink
Add additional instructions on how to check mail using curl
Browse files Browse the repository at this point in the history
  • Loading branch information
mjmayer committed Apr 12, 2018
1 parent 8928ad3 commit e22f578
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion getting_started/step_by_step/yougotmail.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,21 @@ Check Mail
----------

In this example we are going to be checking mail for the address `admin@mailsac.com`.
Using curl we need to do a little bit of manual formatting of the API URL.
We will be using
the `List Inbox Email Messages <https://mailsac.com/docs/api/#list-inbox-email-messages>`_ endpoint.
Documentation shows this endpoint can be accessed with :code:`GET /api/addresses/:email/messages`. We
will substitue `:email` with `admin@mailsac.com` giving us :code:`GET /api/addresses/admin@mailsac.com/messages`.
Curl does not encode URLs for us, so the `@` character needs to be url encoded as `%40` giving us
:code:`GET /api/addresses/admin%40mailsac.com/messages`. The base URI of the mailsac API is mailsac.com, which gives
us the full URL :code:`https://mailsac.com/api/addresses/admin%40mailsac.com/messages`

.. tip:: You can validate the url is properly formatted by accessing it in your web browser. Go ahead and try it with
our `example <https://mailsac.com/api/addresses/admin%40mailsac.com/messages>`_ or try it with a different email address.

Curl requires us to add a few extra parameters. `-X GET` instructs curl to us a HTTP GET request. `-s` supresses
a progress bar. In the command below we pipe the contents of curl into JQ for json formatting. JQ requires a filter to function.
We are using the simplest filter `"."` which matches all json.

.. literalinclude:: /about/intro_curl.bash
:language: bash
:lines: 1

0 comments on commit e22f578

Please sign in to comment.