on 2021 Jan 28 11:36 AM
Hello All,
Our requirement is to query a GraphQL based api from CPI and push the response to C4C for ticket creation and customer creation.
So we are able to fetch the Bearer token for OAuth based authentication in CPI but when I try to push the same graphql request payload from CPI to the Rest API endpoint which is very much working and giving the response back from Postman, it gives the underlying error
"Error Details
org.apache.camel.component.ahc.AhcOperationFailedException: HTTP operation failed invoking https://xyz/graphql with statusCode: 400 "This API request in GraphQL would give a JSON response and the same can be handled by CPI using standard convertors available.
But the API not being able to comprehend my GraphQL request itself is the issue.
Update to clarify:
When I say that exactly the same payload worked with postman successfully but did not work with CPI HTTP adapter. The only difference there is as per my observation has been the radio button that we select to announce the request content type in POSTMAN.
I havnt found a way to tell my CPI editor that this is a GraphQL request payload that i am posting.
Not sure what header/parameter do I need to update to replicate this setting in CPI.
Note: I have maintained each and every header as postman in CPI too. But none states anything about GraphQL content type.
How should I handle the scenario here. Any suggestions ?
Regards,
Shikha
I had the same issue. What I did was format the GraphQL as a JSON. Meaning for example if you have the following query:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
13 | |
11 | |
10 | |
9 | |
9 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.