Skip to Content
0
Jan 15, 2023 at 08:15 AM

JSONThreatProtection[JSON-Threat-Protection]: Execution failed. reason: Expecting { or [ at line 1"

243 Views

Hello All,

i am accessing an external API , but while calling it getting error of json threat protection {"fault":{"faultstring":"JSONThreatProtection[JSON-Threat-Protection]: Execution failed. reason: Expecting { or [ at line 1","detail":{"errorcode":"steps.jsonthreatprotection.ExecutionFailed"}}},

anyone have any idea of this please advise the solution

below is my code

Thanks

concatenate 'Bearer' ls_data-access_token into lv_token separated by space.
clear lo_http_client.
*Creation of New IF_lo_http_client Object
cl_http_client=>create_by_url(
  exporting
    url                = lv_url
  importing
    client             = lo_http_client
  exceptions
    argument_not_found = 1
    plugin_not_active  = 2
    internal_error     = 3
).
if sy-subrc is not initial.
* Handle errors
endif.


call method lo_http_client->request->set_method
  exporting
    method = 'POST'.
call method lo_http_client->request->set_header_field
  exporting
    name  = 'Content-Type'
    value = 'application/json'. 
call method lo_http_client->request->set_header_field
  exporting
    name  = 'Content-Length'
    value = '0'.

call method lo_http_client->request->set_header_field "We pass header and value
  exporting
    name  = 'Authorization'
    value = lv_token.
call method lo_http_client->send
  exceptions
    http_communication_failure = 1
    http_invalid_state         = 2
    http_processing_failed     = 3
    others                     = 4.
call method lo_http_client->receive
  exceptions
    http_communication_failure = 1
    http_invalid_state         = 2
    http_processing_failed     = 3
    others                     = 4.

call method lo_http_client->response->get_status
  importing
    code   = lv_code
    reason = lv_reason.<br>