You need to sign in to do that
Don't have an account?

Einstein Language Intent - 400 Bad Request
I have been trying to use the Intent Web Service and I am able to get a 200 and Response when I POST from cURL and SOAPUI. However, when I construct the request body in APEX and POST am getting a Error - 400 which is a generic BAD request response. I have inspected the requests from cURL and my Apex anonymous code and both are identical. Not sure why I am getting this error. With limited error message details (since Language is still in Beta) am unable to proceed. Below are screenshots from requestbin -
POST from Salesforce -

POST from cURL -

POST from Salesforce -
POST from cURL -
Can you try again? We just made a change that should address any outstanding issues.
Thanks!
Can you provide the API call without your oauth token?
Am using the https://api.einstein.ai/v2/language/intent and am getting a failed to connect to Port 80 exception while trying to POST from cURL.
Below is the API call -
Http h = new Http();
// Instantiate a new HTTP request
HttpRequest req = new HttpRequest();
req.setMethod('POST');
// Send the request, and return a response
String contentBoundary = HttpFormBuilder.WriteBoundary();
String modelId = ''; //insert your model Id
String sampleId= 'test';
req.setEndpoint('https://api.einstein.ai/v2/language/intent');
String content = 'how is my package being shipped?';
String contentType = '';//'\nContent-Type: text/plain\nContent-Transfer-Encoding: gzip';
String token = 'Insert the token here';
// assemble the body payload
String headerValue = '----' + contentBoundary + contentType+ '\nContent-Disposition: form-data; name="modelId";\n\n' + modelId + '\n';
String body = '----' + contentBoundary +contentType+ '\nContent-Disposition: form-data; name="document";\n\n' + content + '\n';
String bodySample = '----' + contentBoundary + '\nContent-Disposition: form-data; name="sampleId";\n\n' + 'Test' + '\n';
String footer ='----'+ contentBoundary + '--' ;
String bodyPayload = headerValue + body + footer;
String authorizationHeader = 'Bearer ' + token;
//EncodingUtil.base64Encode(headerValue);
req.setHeader('Content-Type', 'multipart/form-data; boundary=' + '--'+ contentBoundary);
req.setHeader('Authorization', authorizationHeader);
req.setHeader('Cache-Control', 'no-cache');
//if the request and response for your REST call is JSON, use the code below.
req.setHeader('accept', '*/*');
req.setHeader('Compressed', 'true');
// system.debug('the body of the request is '+bodyPayLoad);
//req.setHeader('Accept', '*/*');
req.setBody(bodyPayload);
system.debug('request is'+req.getBody());
HttpResponse res = h.send(req);
system.debug('the response is '+ res.getBody());