REST API: Error 400 Bad Request - Solition

REST API Error 400 Bad Request

If you are trying yo invoke a REST API but you get some error like this its because there is a problem with headers.

SOLUTION

To solved this problem its neccesary verify your headers, for example

 

  cl_http_client=>create_by_url(
  EXPORTING
    url                = lv_string
  IMPORTING
    client             = http_client
  EXCEPTIONS
    argument_not_found = 1
    plugin_not_active  = 2
    internal_error     = 3
    ).

  IF sy-subrc IS NOT INITIAL.
* Handle errors
  ENDIF.

What you need to be sure its you have added your added yout header contest-type. Added the 'Content-Type' as 'application/json' in headers usually this solved the issue.

Try to test your service with POSTMAN tool. Download on this link: https://www.postman.com/

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Go up