Solved

error -:{"errors":[{"message":"Unexpected end of document","locations":[]}]}

  • 16 April 2024
  • 8 replies
  • 68 views

Userlevel 2

I am trying to get data using pipefy API
following is the query which i am using in my java code to execute post request on pipefy but i am getting following error 

query-:
query allCardUpdatedYesterday {
card(id: "785258522") {
current_phase {
name
}
}

error-:
{"errors":[{"message":"Unexpected end of document","locations":[]}]}

(note -: using spring boot 2.5.5 with java 11)

icon

Best answer by rahil-khan 28 April 2024, 06:04

View original

8 replies

Userlevel 2

Hello @rahil-khan, I was hoping you could provide me with the complete code snippet for the request you mentioned earlier. My main concern is whether or not you included the `Content-Type` header in the request and set it to `application/json`. Although the query itself appears to be fine, I'd like to confirm this aspect to ensure everything is working as intended.

 

Thank you.

Userlevel 2

Hi @gabriel-custodio , Kindly go through the code snippet I have attached and as required I have included the content-type and getting the below exception.

HttpHeaders headers = new HttpHeaders();

headers.set(HttpHeaders.AUTHORIZATION, "Bearer " + apiKey);

headers.setContentType(MediaType.APPLICATION_JSON);

 

HttpEntity<String> requestEntity = new HttpEntity<>(testQuery, headers);

 

ResponseEntity<String> responseEntity = restTemplate.exchange(apiUrl, HttpMethod.POST, requestEntity,

String.class);

 

return requestEntity.getBody()+" "+responseEntity;

exception:

{
    "timestamp": "2024-04-17T05:05:53.241+00:00",
    "status": 500,
    "error": "Internal Server Error",
    "path": "/payment-export-reports/api/esb/v1/data"
}

Userlevel 6
Badge

Hello @rahil-khan!

To make the first appointment, could you try this way?

query allCardUpdatedYesterday {
card(id: "785258522") {
current_phase {
name
}
}

 

Let me know if it worked :)

Userlevel 2

Hello @rahil-khan,

 

I noticed that according to the error message you provided, that you were trying to use an endpoint named `/payment-export-reports/api/esb/v1/data`. However, this endpoint is not exposed by Pipefy, is it? I am wondering if you meant to use `/graphql` instead? 

Userlevel 7

Hi @rahil-khan!

Were you able to execute this?

 

If you're still having problems, could you give us the information that Gabriel asked about, please?

Userlevel 7
Badge +18

Hello @rahil-khan,

 

I noticed that according to the error message you provided, that you were trying to use an endpoint named `/payment-export-reports/api/esb/v1/data`. However, this endpoint is not exposed by Pipefy, is it? I am wondering if you meant to use `/graphql` instead? 

Good!

Userlevel 2

Hello Pipefy community, after exhausting all possible solutions, I finally managed to resolve the issue by upgrading to Spring Boot version 17. This version includes GraphQL starter dependencies, making it much easier to access GraphQL APIs. Thank you to everyone for your assistance and suggestions.

Userlevel 7

Thank you for sharing with us @rahil-khan 

Reply