1

i have to make call from NetSuite to SalesForce.

How do I prepare Salesforce to accept HTTP request from an external system?

i followed above instructions then Apex Rest calls are working fine in fiddler & similar tools without access token.

But when i am calling it from NetSuite Scripts its giving below error

 [{"errorCode":"NOT_ACCEPTABLE","message":"Accept header specified in
 HTTP request is not supported: text/*"}]

What am i missing here ?

2
  • Your request from Netsuite is include a "Accept: text/*" HTTP header in its request, which then causes the error (as there are no response types that match text/*) you need to update your Netsuite code to either not set this header, or set it to a supported value (e.g. application/json)
    – superfell
    Commented Dec 4, 2015 at 20:27
  • This is actually not 100% true. Please see my answer below for the full details (I just ran into this doing a Restlet call to NetSuite). NetSuite requires a body to come back which is why you need to specifically set it as well as set the header to JSON. Commented Dec 8, 2015 at 17:45

1 Answer 1

-1

Please see the following question: How do I prepare Salesforce to accept HTTP request from an external system?

You will notice that you need the following to define your response:

 RestRequest req = RestContext.request;
 RestResponse res = RestContext.response;
 res.addHeader('Content-Type', 'application/json'); 
 String jsonResponse = '';
 String yougetparameter = req.params.get('addyourgetparameter');
 res.statusCode = 200;
 jsonResponse = '{"response": {"status": "Success", "message":"Received."}}';
 res.responseBody = blob.valueOf(jsonResponse);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .