Customer sessions

This endpoint is used to provide access for the customer (end-user) to the phone.systems™ User Interface. The endpoint responds with a URL and token that should be used when redirecting and authenticating the customer to the UI.

Refer to the scheme bellow for an implementation example:

customer session scheme

A single customer may have only one active session at the same time. A newly generated session will cancel the previous one.

The following HTTP method is available:

Creating a customer session

Use the HTTP POST method to create a new customer session.

POST

/api/rest/public/operator/sessions

Request and Response examples:

http

POST /api/rest/public/operator/sessions HTTP/1.1
Host: api.telecom.center
Content-Type: application/vnd.api+json
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

{
  "data": {
    "type": "sessions",
    "relationships": {
      "customer": {
        "data": {
          "id": "123",
          "type": "customers"
        }
      }
    }
  }
}

curl

curl -i -X POST https://api.telecom.center/api/rest/public/operator/sessions -H "Content-Type: application/vnd.api+json" --data-raw '{"data": {"relationships": {"customer": {"data": {"id": "123", "type": "customers"}}}, "type": "sessions"}}' --user username:password

response

HTTP/2 201 Created
Content-Type: application/vnd.api+json

{
  "data": {
    "id": "123",
    "type": "sessions",
    "attributes": {
      "uri": "https://api.telecom.center/api/rest/public/operator/auth?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjQzNzEsImV4cCI6MTU5ODYxNzQyMX0._l5wIR74Cm8rku7vk9ZHCP-AhDMu2ESAb732irl18YM"
    }
  }
}

Redirect the customer to a “uri” that is included in the response body. Afterwards, the user will be automatically redirected to a URL pointing to the customer’s phone.systems™ User Interface.

URL example: https://custom.phone.systems?token=YiJwhkmdnMSwqGCHxaUtRXLGdkyqPDpf

As a result, the customer is automatically logged in to the phone.systems™ User Interface and can make adjustments to their PBX account.