Skip to main content
Solved

_response_body is not in JSON format

  • 12 June 2024
  • 7 replies
  • 77 views

Hi
I am using the HTTPCaller to get the information from Issues page in Autodesk Construction Cloud (ACC).

The AuthorizationToken has been created and looks good but once I am using HTTPCaller to get information form issues page,  the result created in “_response_body” is not in the json format so consequently I am not able to use JSON extractor 

Is there any step that I am missing?

P.S:
In “HTTPCaller4”

in requested URL I used “https://developer.api.autodesk.com/docs/issues/projects/$(PID)/issues
*I have predefined $(PID) in User Parameter.

 

In Header I used “Authorization Token” created in 1st step

Thanks

7 replies

Badge +24

Could you try Bearer @Value(AutorizationToken) in stead of @Value(AutorizationToken

https://aps.autodesk.com/en/docs/oauth/v2/developers_guide/basics/

 

 

Userlevel 1
Badge +12

Hi, is it an idea to explicitly ask for a JSON response by specifying an HTTP Header in the HTTPCaller? Like this:

See e.g. this Stackoverflow question

Badge +7

Could you try Bearer @Value(AutorizationToken) in stead of @Value(AutorizationToken

https://aps.autodesk.com/en/docs/oauth/v2/developers_guide/basics/

 

 

Hi 
The Autorization token has “Bearer” in front of it self. I just combined the values using User Parameter.
I changed it to be in format like “Bearer” + “access token” but it is still give me the result in http format and the result is like this :(

“<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Autodesk Construction Cloud"/><style>body {
        margin: 0;
      }”

Badge +7

Hi, is it an idea to explicitly ask for a JSON response by specifying an HTTP Header in the HTTPCaller? Like this:

See e.g. this Stackoverflow question

Thanks for your response 
I used that but still I am not getting the correct response in json format
A part of response body is like this

““<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Autodesk Construction Cloud"/><style>body {
        margin: 0;
      }””

 

Badge +24

Getting an HTML page usually means that the API tries to inform you that your login is not working.

It could be the HTML page has a readable indication what you are doing wrong, but most of the time it does not.

Things that could go wrong are not requesting the right URL, using GET where POST is demanded, not sending the right headers like referer_url or scope, having the wrong layout for the token, not having the right request body etc.

Are you sure you need to use GET? Seems logic if you request the issues.
Are you sure you send the right headers?
Is the $(PID) correctly translated or is it requesting /projects/$(PID)/issues or /projects//issues

Does $(PID) contain anything that needs to be escaped?

You are using:
https://developer.api.autodesk.com/docs/issues/projects/$(PID)/issues

I looked into the documentation and found:
https://developer.api.autodesk.com/construction/issues/v1/projects/:projectId/issues

It could be docs and construction both have an endpoint, but construction specifies that it uses API v1 and you don't. I also found some endpoint mentioning v2.

 

Badge +7

Getting an HTML page usually means that the API tries to inform you that your login is not working.

It could be the HTML page has a readable indication what you are doing wrong, but most of the time it does not.

Things that could go wrong are not requesting the right URL, using GET where POST is demanded, not sending the right headers like referer_url or scope, having the wrong layout for the token, not having the right request body etc.

Are you sure you need to use GET? Seems logic if you request the issues.
Are you sure you send the right headers?
Is the $(PID) correctly translated or is it requesting /projects/$(PID)/issues or /projects//issues

Does $(PID) contain anything that needs to be escaped?

You are using:
https://developer.api.autodesk.com/docs/issues/projects/$(PID)/issues

I looked into the documentation and found:
https://developer.api.autodesk.com/construction/issues/v1/projects/:projectId/issues

It could be docs and construction both have an endpoint, but construction specifies that it uses API v1 and you don't. I also found some endpoint mentioning v2.

 

So attached is the http page that I am trying to get access through HTTPCaller
On the 1st section I took the token “Http:POST” from the ACC website. (I was success)
On the 2nd one I tried to get connect to the “Project” page of the website (I was success)

On the 3rd one I tried to get access to the “Issues” page which got that problem.
Even, I tried to copy/paste the URL directly, but I got same result.

 

 

Badge +24

Had to try it myself.

First of all: Apparently sometimes you need to remove the “b.” from the start of your projectid. And that's true for this endpoint.

Looking at the issues page in BIM360 I saw a POST request to:
https://developer.api.autodesk.com/issues/v2/containers/@Value(projectID)/issues:batchGet

The request body contains:
 

{
"limit": 50,
"offset": 0,
"sortBy": "-displayId",
"filter[status]": "draft,open,answered,work_completed,ready_to_inspect,not_approved,in_dispute"
}

That way I figured that a GET request on this url should also work:
https://developer.api.autodesk.com/issues/v2/containers/@Value(projectID)/issues

So no ‘docs’ or ‘construction’ but issues/v2/containers.

Note: I first tried using the documentation but that gave me lots of errors.

Second: I use the autodesk Webconnection for authentication. Installing the "AutodeskDocsConnector” transformer and adding a connection. And then selecting this connection in the HTTPCaller.

 

It helps looking at the developer-tools in your browser to see the web requests. And the Webconnections help you with authentication. But it also makes it less transparent, what is happening.

Reply