POST Request Mapillary API V4 (OAuth 2.0 authorization)

Hi,

I am planning to use end points that belong to Mapillary, including, and I want to move my Python code to Knime to use their APIs to store the data in JSON file.

  1. Root endpoint for metadata: https://graph.mapillary.com
  2. Vector tile coverage endpoint: https://tiles.mapillary.com/maps/vtp/mly1_public/2/{z}/{x}/{y}

I used POST REQUEST WIZARD to define the client ID and client secret (It can be defined here). Then I used POST Request to connect to URL https://graph.mapillary.com?token.

I changed the request body to
client_id=CLIENT_ID&client_secret=CLIENT_SECRET&
redirect_uri=REDIRECT_URI&grant_type=AUTHORIZATION_CODE

I face the bad request error when get request to the endpoints. Their authentication endpoints follow the standard OAuth 2.0 authorization code flow, and I am not sure how I should set it in Knime and how I should define the refresh token. Does anyone here have a lead on how to set the exchanges with an authorization code ?

Thanks

Hi @NeginZarbakhsh,

I don’t know the POST Request Wizard Component - it looks like a shared component, maybe from a colleague? Still I can give you some pointers when it comes to authorizing against APIs.

I think you are on the right track already - via the token exchange endpoint (POST https://graph.mapillary.com/token) you’d get the access token, given you provided the correct parameters. As I don’t have the component at hand you are using, I’d use the POST Request node and configure it like the following.

In the Connection Settings tab, put in the endpoint as a URL

In the Request Body, type in the parameters. The optional parameters are not needed, if I read the documentation correctly

Finally, use the Request Headers tab to put in the client secret

If done correctly, you should get back a json column, that you can extract the access_token from with a JSON Path node. In a similar fashion, you can use this access token in other GET/POST/PULL/… Request nodes as a Header in the Request Headers tab to authenticate.

I can also highly recommend crafting the API calls via Postman before putting them into KNIME - it can be easier to debug there and once the calls are setup correctly, you can port them to the KNIME nodes.

I hope that helps!
Lukas

2 Likes