• JeanMarc Soumet
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hi, I tried the CURL commands for Einstein Language Intent following the examples in https://metamind.readme.io/ for uploading datasets, training them and predicting and they worked just fine in bash Terminal. However, I'm unable to find the method in HttpRequest class in Apex to replace -F in curl commands like in the example
curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Cache-Control: no-cache" -H "Content-Type: multipart/form-data" -F "path=http://einstein.ai/text/case_routing_intent.csv" -F "type=text-intent" https://api.einstein.ai/v2/language/datasets/upload

Please help me implement Language Intent.
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 -

User-added image

POST from cURL -

User-added image