function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Bern RudisillBern Rudisill 

Live Agent REST and CORS

I am trying to create a web chat client using the SalesForce Live Agent REST API but I am running into an issue with CORS. Is tehre a way to get SalesForce to enable CORS or does the REST API support JSONP, if so do you have some examples, if not then what would be the proper way to use the Live Agent REST API with JavaScript? I am currently using a proxy I quickly created on my server which seems to be working but does cause a little slowdown.
James LoghryJames Loghry
Bern,

You should be able to follow the example here (it should be the same for the Live Agent REST API as it is for Chatter, etc). https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/extend_code_cors.htm
Bern RudisillBern Rudisill
I did try following that example and it did not seem to work for the Live Agent REST.
Marcel dos SantosMarcel dos Santos
Did you find any solution for this? I'm having the same error.
I'm trying to implement a live agent client with angular and making ajax calls to the live agent rest api. I'm getting the same 400 error on the preflight request. Do you know if there is any solution for this?
Bern RudisillBern Rudisill
You can’t do it from the client side, there are really 2 ways to do this for a web app, 1) install a proxy on your server to pass the REST calls through or 2) if you are creating an MV* app create a controller with all the REST calls Bern Rudisill CMS Developer Bisk Education, Inc. 9417 Princess Palm Avenue Tampa, FL 33619 • 813.621.6200 x6248 • bern-rudisill@bisk.com