9. Testing with Autorize

When using Autorize we need to pass the JSON as a cookie instead of a normal curl http request and the syntax for that is going to be:

curl -X PUT "Content-Type: application/json" -b "session=JWT" -d '{"username": "jeremy", "bio": "new bio v2"}' http://localhost/labs/api/v2/account.php

Requests for this chapter

Users:

  • jeremy:cheesecake

  • jessamy: tiramisu

POST /login.php

curl -X POST -H "Content-Type: application/json" -d '{"username": "admin", "password": "password123"}' http://localhost/labs/api/login.php

GET /account.php

curl -X GET "http://localhost/labs/api/account.php?token=JWT"

PUT /account.php

curl -X PUT -H "Content-Type: application/json" -d '{"token": "JWT", "username":"username", "bio": "New bio information."}' http://localhost/labs/api/account.php