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
Hello,
Adding to what Maik has already said, you can also enable trace(or BLOG) to see the actual payload/mesage content being passed from the HTTP adapter to external graphql API. This will give you a fair idea if there is any parameter missing or some extra line breaks are generated by CPI (in case of batch mode) etc etc.
BR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Saurabh,
Tried posting the GraphQL request payload from CPI again by declaring the Content type header as 'application/graphql' although in Postman it is 'application/json' for this request.
The error now changed to :
"org.apache.camel.component.ahc.AhcOperationFailedException: HTTP operation failed invoking https://api.iadvize.com/graphql with statusCode: 415"
which means this is an Unsupported Media Type.
Any other suggestions please.
Regards,
Shikha
Hmmm... But http-415 means that when you passed "application/graphql" as the content-type header then the target graphql server didn't even accept the request with the content type mentioned. Hence my assumption would be that grapql server is expecting content-type other than "application/graphql", but thats the max we can guess just by looking at the explanation or pictures you have shared.
Have you tried contacting SAP support? What they say?
Hello,
You are very correct.
Before even attempting this , I was aware that the graphql server i.e iAdvize in our case expects
content-type header to have"application/json " as is clearly stated in there documentation. But having tried that already ,since the HTTP 400 was coming in that case.
I just am not sure what should be the header to explain this request as GraphQL to the server (like the Postman->radio button serves that purpose).
Hence tried this change of content type "application/graphql" as hinted by blog that Maik shared.
The ticket is open with SAP .Still waiting for responce
Regards,
Shikha
User | Count |
---|---|
71 | |
11 | |
11 | |
10 | |
9 | |
9 | |
7 | |
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.