GetStateInstance#
The method is aimed for getting the account state.
Request#
To get the account state, you have to execute a request at:
GET https://api.greenapi.com/waInstance{{idInstance}}/getStateInstance/{{apiTokenInstance}}
For idInstance
and apiTokenInstance
request parameters, refer to section Before you start.
Response#
Response parameters#
Parameter | Type | Description |
---|---|---|
stateInstance | string | Account state. Have variants: |
notAuthorized - Account is not authorized. For account authorization refer to Before you start section | ||
authorized - Account is authorized | ||
blocked - Account banned | ||
sleepMode - Account is in sleep mode. The state is possible when the phone is switched off. After the phone is switched on, it may take up to 5 minutes for the account state to be changed to authorized . | ||
starting - The account is in the process of starting up (service mode). An instance, server, or instance in maintenance mode is rebooting. It may take up to 5 minutes for the account state to be set to authorized . | ||
yellowCard - Sending messages has been partially or completely suspended on the account due to spamming activity |
Response body example#
{
"stateInstance": "authorized"
}
Errors GetStateInstance#
For a list of errors common to all methods, refer to Common errors section
Request examples#
import requests
url = "https://api.greenapi.com/waInstance{{idInstance}}/getStateInstance/{{apiTokenInstance}}"
payload = {}
headers= {}
response = requests.request("GET", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
curl --location 'https://api.green-api.com/waInstance{{idInstance}}/getStateInstance/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append("https://api.greenapi.com")
.append("/waInstance").append({{idInstance}})
.append("/getStateInstance/")
.append({{apiTokenInstance}});
var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.GET, null, String.class);
System.out.println(response);
var requestUrl = new StringBuilder();
requestUrl
.append("https://api.greenapi.com")
.append("/waInstance").append({{idInstance}})
.append("/getStateInstance/")
.append({{apiTokenInstance}});
var response = Unirest.get(requestUrl.toString())
.header("Content-Type", "application/json")
.asString();
System.out.println(response);