POST request form data

I am wondering how to perform a POST request to this endpoint with a form data payload in Knime without using non-partner extensions (like Palladian).

In Postman, I’m performing this request with no additional headers aside from the default ones pre-computed by Postman itself

In Knime, the POST request node fails with

error 400: Invalid client

supposedly meaning that some error has to be in the client_id parameter, although it’s completely correct. Even curl does not pose this error, only Knime does.

At the moment I worked around this error by using a Python / Java snippet node, but I was wondering if there was a native solution to this.
The API has free registration if anyone wants to try it. During registration it asks for an affiliated company, but you can type anything.

KNIME_project.knwf (80.5 KB)

Turns out that a body with a JSON payload isn’t the correct way to do so. Based on this StackOverflow article, keys and values should be paired with a = and separated by a & just like a normal GET request would behave.

Thus, in my case, instead of passing the body as

{
“client_id” : “my_client_id”,
“client_secret” : "my_client_secret,
“grant_type” : “client_credentials”
}

I passed

client_id=my_client_id&client_secret=my_client_secret&grant_type=client_credentials

and it worked.

5 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.