Reply to Trustpilot Review Service Reviews API returning 400 Bad Request (Apex Salesforce)

95 Views Asked by At

This is my code in Salesforce


                HttpRequest req = new HttpRequest();
                req.setEndpoint('callout:TrustPilot/private/reviews/'+reviewId+'/reply?token='+token);
                req.setMethod('POST');
                req.setHeader('Content-Type', 'application/json;charset=UTF-8');
                reqString ='{'+
                            '"message": "'+replyBody+'",'+
                            '"authorBusinessUserId": "'+buserId+'"'+
                           '}';
                req.setBody(reqString);
                Http http = new Http();
                HTTPResponse res = http.send(req);

This code returns a 400 Bad Request error. AA Not sure where I'm going wrong as the exact code line works in a test environment but not in my production.

Endpoint - callout:Trustpilot - this is basically 'https://api.trustpilot.com/v1'

Any help would be appreciated!!

Im trying to post a reply to a trustpilot review using REST API

Expected response would be StatusCode - 201 Created

0

There are 0 best solutions below