GetStateInstanceHistory#
The method is used to get the history of the instance state.
Запрос#
To get the history of the instance state, you have to execute a request at:
GET
{{apiUrl}}/waInstance{{idInstance}}/GetStateInstanceHistory/{{apiTokenInstance}}
For apiUrl, idInstance and apiTokenInstance request parameters, refer to section Before you start.
Response#
Response parameters#
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
count | integer | No | The number of authorization records on the instance, in chronological order. At default = 100 |
General request body example#
{
"count": 200
}
Response#
Response parameters#
| Parameter | Type | Description |
|---|---|---|
stateInstance | string | Instance state. Have variants: |
notAuthorized - Instance is not authorized. For instance authorization refer to Before you start section | ||
authorized - Instance is authorized | ||
blocked - Instance banned | ||
timestamp | integer | Event time in UNIX format |
phoneNumber | integer | Phone number |
Response body example#
[
{
"stateInstance": "authorized",
"timestamp": 1778132812,
"phoneNumber": "79636191168@c.us"
},
{
"stateInstance": "notAuthorized",
"timestamp": 1778132743,
"phoneNumber": "79636191168@c.us"
},
{
"stateInstance": "authorized",
"timestamp": 1778132546,
"phoneNumber": "79636191168@c.us"
},
{
"stateInstance": "notAuthorized",
"timestamp": 1778131747,
"phoneNumber": "79636191168@c.us"
}
]
Errors GetStateInstanceHistory#
For a list of errors common to all methods, refer to Common errors section
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/GetStateInstanceHistory/{{apiTokenInstance}}"
payload = {}
headers= {}
response = requests.request("GET", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/GetStateInstanceHistory/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/GetStateInstanceHistory/")
.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("/GetStateInstanceHistory/")
.append({{apiTokenInstance}});
var response = Unirest.get(requestUrl.toString())
.header("Content-Type", "application/json")
.asString();
System.out.println(response);
Sub GetStateInstance()
Dim url As String
Dim http As Object
Dim response As String
' The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
url = "{{apiUrl}}/waInstance{{idInstance}}/GetStateInstanceHistory/{{apiTokenInstance}}"
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", url, False
http.Send
response = http.responseText
Debug.Print response
' Outputting the answer to the desired cell
' Range("A1").Value = response
Set http = Nothing
End Sub