force-rest-api
force-rest-api copied to clipboard
BUG with get knowledgeArticles
Hello,
I tried with /services/data/v40.0/support/knowledgeArticles via force-rest-api v40.0 and I get this issue: [{"errorCode":"MISSING_ARGUMENT","message":"Language has to be specified in HTTP header."}]
I search in Google and I know how to fix it: we need add header: Accept-language: en-US,en;q=0.9,vi;q=0.8
Document: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_knowledge_support_artlist.htm
I need its go to maven, b/c i include this client to my project via maven. Could u pls review and fix it and release to maven 0.0.41 ? tks!
Which method in ForceApi are you using? getSObject or get()? It would be great if you can send a pull request with a proposed fix that includes a test.
Hi, im using method get(), and seem like other method get same issue.
Actually it just need add 1 more header: header("Accept-language", "en-US,en;q=0.9,vi;q=0.8") like this:
return new ResourceRepresentation(this.apiRequest((new HttpRequest()).url(this.uriBase() + path).method("GET").header("Accept", "application/json").header("Accept-language", "en-US,en;q=0.9,vi;q=0.8")), this.jsonMapper);
Btw, I think the best way is: the api should allow add headers to request