quickstart.rst 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. Quickstart
  2. ----------
  3. To use our domain management API, you need to register an account with deSEC.
  4. Here's a quick intro how to get started:
  5. #. :ref:`obtain-a-captcha` and solve it::
  6. curl -X POST https://desec.io/api/v1/captcha/
  7. Note down the captcha ID from the response body, and figure out the
  8. solution from the ``challenge`` field. It's a base64-encoded PNG image
  9. which you can display by directing your browser to the URL
  10. ``data:image/png;base64,<challenge>``, after replacing ``<challenge>`` with
  11. the value of the ``challenge`` response field
  12. #. :ref:`register-account`::
  13. curl -X POST https://desec.io/api/v1/auth/ \
  14. --header "Content-Type: application/json" --data @- <<EOF
  15. {
  16. "email": "youremailaddress@example.com",
  17. "password": "yourpassword",
  18. "captcha": {
  19. "id": "00010203-0405-0607-0809-0a0b0c0d0e0f",
  20. "solution": "12H45"
  21. }
  22. }
  23. EOF
  24. Before activating your account, we need to verify your email address. To
  25. that end, we will send you an email, containing a validation link of the
  26. form ``https://desec.io/api/v1/v/activate-account/<code>/``. To confirm
  27. your address and activate your account, simply click the link.
  28. #. :ref:`log-in`::
  29. curl -X POST https://desec.io/api/v1/auth/login/ \
  30. --header "Content-Type: application/json" --data @- <<< \
  31. '{"email": "youremailaddress@example.com", "password": "yourpassword"}'
  32. The response body will contain a ``token`` secret which is used to
  33. authenticate requests to the DNS management endpoints as demonstrated in
  34. the next step.
  35. Note that tokens created by the login endpoint have limited validity (see
  36. the ``max_age`` and ``max_unused_period`` fields in the response). To
  37. create a long-lived API token, please refer to :ref:`manage-tokens`.
  38. #. Create a DNS zone::
  39. curl -X POST https://desec.io/api/v1/domains/ \
  40. --header "Authorization: Token {secret}" \
  41. --header "Content-Type: application/json" --data @- <<< \
  42. '{"name": "example.com"}'
  43. #. Yay! Keep browsing the :ref:`domain-management` section of the docs to see how
  44. to continue.