5

I'm attempting to create some API tests to assist with getting familiar with API automation and I'm using the really helpful Restful-Booker API for this. The API documentation is also here.

However I’m having an issue with the DELETE request as given below

enter image description here

I’ve initially created a booking, then I’m looking to delete it but whenever I run the request through Postman I get a 403 Forbidden error as below.

enter image description here

Would someone be able to point me in the direction where I may be going wrong with this.

1 Answer 1

4

You need to provide token generated create Token API here in header under cookie field.

and URL used in not as mentioned in API

https://restful-booker.herokuapp.com/booking/{bookingID}

Please check the screenshot here.

enter image description here

enter image description here

6
  • Hi Sid, thanks for your comment. How do I obtain the cookie from the "create booking API? Commented Sep 14, 2018 at 10:23
  • Hi @Andy use this API to get the token for your User restful-booker.herokuapp.com/apidoc/…
    – Sid
    Commented Sep 14, 2018 at 10:30
  • Thanks Sid. And then do I then need to add this token when I create a booking, and then delete it later on? If you could provide screenshots of the flow you used that would help with my understanding Commented Sep 14, 2018 at 10:36
  • I think only delete requires the token and create booking does not has token in body, it requires all booking related data in body. I have attached screenshot for token creation and my bad i have mentioned there token generated in create booking API, it is separate API as mentioned in above comments. [edited my answer as well :) ]
    – Sid
    Commented Sep 14, 2018 at 10:49
  • That's great, thanks Sid. I've now been able to work this out. Out of interest what's the reasoning behind having to pass these tokens around? Commented Sep 14, 2018 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.