- Desarrolladores appeon 4
- PowerBuilder
- Thursday, 15 February 2024 05:49 PM UTC
Hi
I want to consume a REST service sending the JSON format and get a response from the service.
I get the TOKEN using GetJWTToken, which works fine and it is valid, but when I consume the REST service it's require, it returns an error that tells the following:
{"type":"https://tools.ietf.org/html/rfc7231#section-6.5.13","title":"Unsupported Media Type","status":415,"traceId":"00- 9b842ef37383feb036f413cd6560d311-c8b3cffffab8c86b-00"}
In a simple google search of this 415 error on the site https://tools.ietf.org/html/rfc7231#section-6.5.13; indicates the following:
"6.5.13. 415 Unsupported Media Type
The 415 (Unsupported Media Type) status code indicates that the
origin server is refusing to service the request because the payload
is in a format not supported by this method on the target resource.
The format problem might be due to the request's indicated
Content-Type or Content-Encoding, or as a result of inspecting the
data directly."
The procedure (code) I am doing the call of the service is the following:
"
li__P020_SendReturn = irc_json_envio.SendPostRequest("https://ea1-test.apis.sietesdata.com/api/Sietes/SendJson", ls_PostData, ls_P020_Responsebody)
If li__P020_SendReturn <> 1 Or irc_json_envio.GetResponseStatusCode() <> 201 Then
//Checks if any error information
ll_response = irc_json_submission.GetResponseStatusCode()
ls_StatusText = irc_json_envio.GetResponseStatusText()
messagebox( ' of_json_envio_test fails ' , 'irc_json_envio.GetResponseStatusCode() ' + String( irc_json_envio.GetResponseStatusCode() ) + ' ' + ls_StatusText + '~r~n~r~nls_P020_Responsebody ' + ls_P020_Responsebody )
Else
messagebox( ' of_json_test_submission ' , 'ls_P020_Responsebody ~r~n' + String( ls_P020_Responsebody ) )
as_response = ls_P020_Responsebody
ll_response = irc_json_submission.GetResponseStatusCode()
End If
messageBox( ' of_json_test_sending - Output' , ' li__P020_SendReturn ' + String( li__P020_SendReturn) )
messageBox( ' of_json_test_submission - Output - ls_P020_Responsebody ' , ls_P020_Responsebody )
"
We have been used POSTMAN to verify the JSON sending test and the results have been accurate.
So, I want to kwon if I did something incorrect using these functions or I have to considerate anything else.
Thanks in advance.
Best Regards.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.