Hi Sarala,
No worries, doesn’t bother me, but in many forums it can cause you issues, so I mention it to hopefully save you from some nasty comments.
Great news, you’ve ruled that out, I’ve seen many applications where 1 missing header can mean you get an obscure error that doesn’t even hint as whats missing.
Same thing with request bodies, some app servers are really case sensitive, also spaces vs underscores will often trip you up so it’s best to make sure these are all the same, as in the past I’ve spent hours trying to solve an issue that turned out to be the difference between an S and an s, which is why I point these things out first.
So just to confirm, in Postman you do:
Call OAUTH API (is this a POST or GET?) → get back bearer token → call the actual API service using the bearer token
In Rrobot framework you are trying to get requests library to do:
Call OAUTH API (is this a POST or GET?) → get back bearer token
So that brings me to where does ${Key} and ${Secret} come from, and do they remain static? Is there some sort of fingerprinting happening on the server that once you use them with Postman then the server registers that and future requests from any other app will fail regardless what you do? This is something you might have to ask the developers down the track. Also do these expire?
Ah ha, so the OAUTH API doesn’t require them but the actual API service does, or at least one of them. Once you get past OAUTH call if you are planning to hit the actual API service, you’ll need to keep that in mind.
As I mentioned before with out the actual request headers and bodies that both Requests Library and Postman sent to compare, there’s really no way to guess what your problem might be, which is why my suggestions are generic in nature, pointing you in the most likely places to look.
HTTP protocol is quite simple really, there’s really only 3 places you can get things wrong:
- the URL
- the request headers
- the request body
And the last one only really applies to POST requests, all of them are plain text so easy to compare, get all of them right and you’ll get the expected result.
BTW also double check ${Secret}, i typed it into a base 64 decoder and got “not a UTF-8 string”, If you changed some characters to post here then that’s OK, just make sure they are the same in rf and postman.
Dave.