Skip to content

CallsGetStateInstance#

Beta version

The functionality is in beta mode. Features are subject to change and may also work unstably. There may be additional charges for functionality in the future.
You can request access to the functionality via GREEN-API support

The method is used to get the instance state history on the Calls plan.

Request#

To get the state of the calls session, you have to execute a request at:

GET
{{apiUrl}}/waInstance{{idInstance}}/callsGetStateInstance/{{apiTokenInstance}}

For apiUrl, idInstance and apiTokenInstance request parameters, refer to Before you start section.

Request parameters#

Parameters can be specified selectively.

Parameter Type Mandatory Description
count integer No Number of authorization records on the instance in chronological order. Default: count = 100

Request body example#

{
    "count": 200
}

Response#

Response parameters#

Parameter Type Description
stateInstance string Instance state on the Calls plan. Takes the values:
notAuthorized - The instance is not authorized
authorized - The instance is authorized
blocked - The instance is banned
timestamp integer Event time in UNIX format
phoneNumber integer Phone number

Response body example#

{
    "callsStateInstance": "authorized"
}

Errors#

For a list of errors common to all methods, refer to Common errors section

HTTP code Description
404 Instance not found

Request examples#

import requests

url = "{{apiUrl}}/waInstance{{idInstance}}/callsGetStateInstance/{{apiTokenInstance}}"

payload = {}
headers = {}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/callsGetStateInstance/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/callsGetStateInstance/")
    .append({{apiTokenInstance}});

var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.GET, null, String.class);
System.out.println(response);
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/callsGetStateInstance/")
    .append({{apiTokenInstance}});

var response = Unirest.get(requestUrl.toString())
    .header("Content-Type", "application/json")
    .asString();

System.out.println(response);