• Peter Schmiz
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi,

I'm trying to use the REST API of Live Agent.
At the moment I'm only using different REST API test tools to test the needed
test.

The first step (getting session ID) is working, but right after when I'm trying to initiate
a chat either I get error 400 (bad request, probably because I played around with the headers)
or 503 - Service not available.

I'm stuck, because tried almost everything I could find, and nothing works, can't
initiate a chat.

Anyone had the same experience or anyone has the solution?

Thanks,
Peter
I'm trying to use the Live Agent REST API but I'm bumping into CORS issue. The AJAX request:
$.ajax({
    type: "GET",
    url: LiveAgent._Url + "/System/SessionId",
    headers: {
        "X-LIVEAGENT-AFFINITY": "null",
        "X-LIVEAGENT-API-VERSION": 35,
    },
    success: LiveAgent.ChasitorInit
})
This results in a preflight (OPTIONS) HTTP request with the following headers:

Access-Control-Request-Method: GET
Access-Control-Request-Headers: x-liveagent-affinity,x-liveagent-api-version
Origin: https://mylocaltest.com

But the response headers only have:

Access-Control-Allow-Origin: https://mylocaltest.com
Access-Control-Allow-Credentials: true

It is missing the Access-Control-Allow-Headers header.