Sending JSON in the body of an HTTP request
Posted: Fri Aug 08, 2025 5:06 pm
The following code is producing this message: {"statusCode": 400, "body": "Not JSON"}
D HTTPAPI_VERSION...
D C CONST('1.23')
D HTTPAPI_RELDATE...
D C CONST('2008-04-24')
I have verified that the JSON is formatted properly and is present in the request variable at the time of the http call.
The logs on the web-service show there is nothing in the body of the request. Am I using the correct procedure call for this?
request = '{JSON stuff here}' ;
t_Endpoint = 'http://theendpoint.com';
// Notify httpapi of the routine to use to add headers
http_xproc( HTTP_POINT_ADDL_HEADER
: %paddr(addSpecialHeaders)
: %addr(authorizationToken) );
response = 'tmp/TEST.json';
rc = http_url_post( t_Endpoint
: %addr(request)
: %len(%trim(request))
: %Trim(response)
: Timeout
: HTTP_USERAGENT
: 'application/json'
);
D HTTPAPI_VERSION...
D C CONST('1.23')
D HTTPAPI_RELDATE...
D C CONST('2008-04-24')
I have verified that the JSON is formatted properly and is present in the request variable at the time of the http call.
The logs on the web-service show there is nothing in the body of the request. Am I using the correct procedure call for this?
request = '{JSON stuff here}' ;
t_Endpoint = 'http://theendpoint.com';
// Notify httpapi of the routine to use to add headers
http_xproc( HTTP_POINT_ADDL_HEADER
: %paddr(addSpecialHeaders)
: %addr(authorizationToken) );
response = 'tmp/TEST.json';
rc = http_url_post( t_Endpoint
: %addr(request)
: %len(%trim(request))
: %Trim(response)
: Timeout
: HTTP_USERAGENT
: 'application/json'
);