Connect to Azure Cosmos DB from ReadyApi
I am trying to find a way to connect to Azure Cosmos DB from readyApi. I assume the best way is to do it using a groovy script but I am not really sure. I searched for a solution here and on the web in general, and even though I can see that I am definitely not the first one trying to achieve this, I was unable so far to find any answer that provides an actual solution...
Any help on this subject would be more than welcome !
Solved! Go to Solution.
have a look at the following link - someone else asked about this awhile ago for SoapUI.
the link provides further link to setup your DB connection using REST rather than JDBC - as long as you're doing reasonably simple queries - using the REST API rather than JDBC should sort you fine.
Thanks. I did see this link but it does not provide a solution for the authentication part, which is the most tricky part to put in place. Apologies, I did not mention that specific item in my previous message.
have a look here --> https://sajeetharan.com/2019/07/01/easily-explore-cosmos-db-rest-apis-with-postman/
I know it says postman - but authentication is authentication and as long as you have all the mandatory headers setup (ignoring the stupid dynamically generated postman ones) you should be able to setup the connection in ReadyAPI!
Hit back if you're still struggling after trying to apply the postman instructions
Thanks Rich for your replies.
I saw these instructions and tried to use them but the authorization generation does not work for some reasons...
I tried to use this in my groovy script :
Everything else is okay, it is the authorization part which fails.
In that case i'd go back and confirm the Cosmos DB version. If that resource i pointed you to was a little old, i know that MS have changed REST auth schemes for a number of their products over the last 5 years. Perhaps those instructions i found were out of date.
Essentially there will be a number of URI/QUERY and HEADER parms you'll need to specify with the correct details, otherwise it wont work. Did you confirm and re-confirm youd specified the correct value for each of those parms defined in the postman instructions? If even one of those parms are incorrect, you wont be able to connect.
Alternatively im guessing you might be able to ask Dev? Considering youre testing their code, it seems logical to think they might know something about this.
The dev team cannot help, they did not implement neither use these APIs. One of the dev tried to help but the MS documentation is not the best IMHO 😞