Glowmarkt API data retrieval using GoogleAppsScript
I want to use GoogleAppsScript and am following the API documentation.
I can successfully perform Step 1.Authenticate, i.e., obtain “valid”:true, and a “token”. I also retrieve an undocumented "isTempAuth":false.
So, then I move to Step 2. Get all virtual identities, using:
· GET,
· "contentType":application/json,
· “applicationId":b0f1b774-a586-4f72-9edd-27ead8aa7a8d,
· and my token.
But I get an exception - “Request failed for https://api.glowmarkt.com returned code 400. Truncated server response: {"error":"bad request","message":"bad request"}”
Have been banging my head for a long time now, any ideas, or anyone else found this?
Comments
I can no longer Authenticate !!!
POST,
· "contentType": application/json,
· “applicationId": b0f1b774-a586-4f72-9edd-27ead8aa7a8d,
· JSON.stringify("username": "xxxxxx", "password": "yyyyyy")
applicationId should go into the body, not the Headers
Hi JerryFr,
Can you show an example of a correctly formed request, please?
I also get a 400 error using the example format.
-- SOLVED --
My brand-new token seemed to have expired.
After getting a new one it all runs correctly.
Glad you have solved.
Do you still want to see my Google Apps script? It may be useful for the community.
@JerryFr 's original post of March 2024 sounds just like what I've been experiencing in my post here https://forum.glowmarkt.com/index.php?p=/discussion/492/api-virtualentity-returns-400-bad-request#latest using "Postman" (following the "...5 easy steps Tutorial/Blog)
However I have achieved success using the Glowmarkt Swagger UI to test run various API calls, which I can then run from the command line (Windows, raspberryPi etc) using the curl (client for URLs) commands generated by Swagger