You need to sign in to do that
Don't have an account?
Denys Peres
SwitchServer response on Live Agent Rest API
We need ways to implement and test the code to handle the SwitchServer response in the Live Agent Rest API. The main questions we have are:
- Which requests can throw this error? ChasitorInit is one, I suppose, but are there any others?
- What is the error code returned along with it?
- Is there any test endpoint we can use to simulate the response? I already tried to switch sandbox and production org ids and endpoints, but only got "503 - Service Unavailable".
- How the mobile SDK handles it? I searched the github repo and found a reference in Feb 2017 release, but there was nothing about how it was handled.
- The response is thrown from Visitor/Availability request only. Seems obvious once you know the answer.
- There is no error code.
- In order to test, you will need support to point an alternative endpoint for you, one that has passed the migration process before. You won't be able to get this response swapping endpoints and org ids in your instance.
- It seems that mobile SDK really solves this, so you only need to worry if you are using an hybrid SDK or custom code.
Here are samples of requests and responses:OK REQUEST:
GET /chat/rest/Visitor/Availability?org_id=000000000000000&deployment_id=000000000000000&Availability.ids=000000000000000 HTTP/1.1
Host: [NEW_ENDPOINT]
X-LIVEAGENT-API-VERSION: 39
X-LIVEAGENT-AFFINITY: null
Content-Type: application/json
OK RESPONSE:
{"messages":[{"type":"Availability", "message":{"results":[{"id":"000000000000000"}]}}]}
...
SWITCH SERVER REQUEST:
GET /chat/rest/Visitor/Availability?org_id=000000000000000&deployment_id=000000000000000&Availability.ids=000000000000000 HTTP/1.1
Host: [OLD_INSTANCE_ENDPOINT]
X-LIVEAGENT-API-VERSION: 39
X-LIVEAGENT-AFFINITY: null
Content-Type: application/json
SWITCH SERVER RESPONSE:
{"messages":[{"type":"SwitchServer", "message":{"newUrl":"[NEW_ENDPOINT]"}}]}
All Answers
- The response is thrown from Visitor/Availability request only. Seems obvious once you know the answer.
- There is no error code.
- In order to test, you will need support to point an alternative endpoint for you, one that has passed the migration process before. You won't be able to get this response swapping endpoints and org ids in your instance.
- It seems that mobile SDK really solves this, so you only need to worry if you are using an hybrid SDK or custom code.
Here are samples of requests and responses:OK REQUEST:
GET /chat/rest/Visitor/Availability?org_id=000000000000000&deployment_id=000000000000000&Availability.ids=000000000000000 HTTP/1.1
Host: [NEW_ENDPOINT]
X-LIVEAGENT-API-VERSION: 39
X-LIVEAGENT-AFFINITY: null
Content-Type: application/json
OK RESPONSE:
{"messages":[{"type":"Availability", "message":{"results":[{"id":"000000000000000"}]}}]}
...
SWITCH SERVER REQUEST:
GET /chat/rest/Visitor/Availability?org_id=000000000000000&deployment_id=000000000000000&Availability.ids=000000000000000 HTTP/1.1
Host: [OLD_INSTANCE_ENDPOINT]
X-LIVEAGENT-API-VERSION: 39
X-LIVEAGENT-AFFINITY: null
Content-Type: application/json
SWITCH SERVER RESPONSE:
{"messages":[{"type":"SwitchServer", "message":{"newUrl":"[NEW_ENDPOINT]"}}]}
Want to check if Denys's answer is still correct?
Also I am curious if handling SwitchServer should be used together with ReconnectSession API, as the session is reconnected, it should use the new server url provided by SwitchServer response I think?