Authentication

All the API keys require JWT token that is time based (expires fast). So it is recommended to refresh your token before you run calls to API's.

There are two ways to get it. First way by providing login password to /login_check call. Second is to use key based authentication.

It is recommended to use the latter so you do not need to store your credentials in your code. Also you can revoke your keys at any moment.

First create a key by going to Keys pages under your account.

Next you need to run POST request to /auth/key to get the token.

curl -X POST "https://diffy.website/api/auth/key" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"key\":\"17a4cb013934ca6d87d8cc****44446e\"}"


Response would have a token you'll need to keep for next calls

{
  "token": "eyJhbGciOiJSUzI1N****RMaDTpoi0K4AZUPdYxw8nx2qiOmDDtpNBOUqQ5EgXBQarGFzW5N7u2etTlnCs9LK0U3cw"
}


Most probably you will have php installed on your deployment server. So to save token value to bash variable you could run

TOKEN=`curl -X POST "https://diffy.website/api/auth/key" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"key\":\"17a4cb013934ca6d87d8cc****44446e\"}" | php -r 'echo json_decode(file_get_contents("php://stdin"))->token;'`

Calling API calls


So now you can run actual API call. For example lets create screenshots from production environment

curl -X POST "https://diffy.website/api/projects/2**/screenshots" -H "accept: application/json" -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d "{\"environment\":\"production\"}"


Full list of all the API calls is available at our swagger documentation https://diffy.website/rest.


Welcome to test it out!


Did this answer your question?