I have figured this out.
A 400 error means that the REST request as set up in the call REST for access token was poorly formatted. I downloaded your model share and the issue is that the spotify web service is looking for un-encoded form data instead of JSON or XML. Specifically, the missing header parameter content-type=application/x-www-form-unencoded
Adding this parameter make this work in Postman and that is what CURL does by default when you do:
I fixed this in Mendix by adding the Content-Type header key with the value 'x-www-form-unencoded' and it worked just fine afterward with the body as is.
Hope this helps,
I do not know the exact reason for the exception that you are getting (unfortunatelly the model share does not show a lot of information about rest calls, but even then I would probably not know).
However, when I run into problems like that it helps to see what the actual message that mendix generates looks like and compare that to what comes from your curl. You can set up a free listener to capture the requests for example using https://hookbin.com/ or https://requestb.in/
Hope this helps,
are you able to get it working in Postman? Whenever i'm implementing a new integration, I found it easier to get it working in postman first. Usually if there is something wrong with the API call, the endpoint will return an error message in JSON that will have useful information.
Here is a link to the postman website: https://www.getpostman.com/
Thanks for sharing your model!
I had the same problem, but for some reason it didn't work until i added the key content-type and value 'application/x-www-form-urlencoded' (so not "unencoded") to the custom HTTP headers. Also, i had no idea the custom request template was the actual "body" of the request..
So this could come in handy for future readers aswell i guess..
Addition for future readers: Set the loglevel of lognode 'REST consume' in the console's log Tab 'Advanced' to Trace. This will show the REST-call Mendix requests with which parameters and headers and one logline later the response Mendix received.