Retrive status of instance

Get the status of the instance

get
/instance_whatsapp/status

https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/status?api_token=tokenAPI&instance=instance_number
Request
Response
Query Parameters
instance
required
string
The instance number
api_token
required
string
The API token
200: OK
In "data" there is an object with a field "accountStatus". This field is like instance_whatsapp.status. If the status is "got qr code" then you need to retrieve the qr code to authenticate (show Obtain QR code).
{
"object": "object",
"data": {
"accountStatus": "authenticated"
},
"has_more": false,
"count_api": 4,
"reset_count_api": 45
}
404: Not Found
GENERIC ERROR

Example

cURL
C#
Go
Java
NodeJs
Objective-C
PHP
Python
Ruby
Swift
curl -X GET \
'https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/status?api_token=tokenAPI&instance=instance_number'
var client = new RestClient("https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/status?api_token=tokenAPI&instance=instance_number");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/status?api_token=tokenAPI&instance=instance_number"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/status?api_token=tokenAPI&instance=instance_number")
.get()
.build();
Response response = client.newCall(request).execute();
var request = require("request");
var options = { method: 'GET',
url: 'https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/status',
qs: { api_token: 'tokenAPI', instance: 'instance_number' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
#import <Foundation/Foundation.h>
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/status?api_token=tokenAPI&instance=instance_number"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
<?php
$request = new HttpRequest();
$request->setUrl('https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/status');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData(array(
'api_token' => 'tokenAPI',
'instance' => 'instance_number'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
import requests
url = "https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/status"
querystring = {"api_token":"tokenAPI","instance":"instance_number"}
payload = ""
response = requests.request("GET", url, data=payload, params=querystring)
print(response.text)
require 'uri'
require 'net/http'
url = URI("https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/status?api_token=tokenAPI&instance=instance_number")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/status?api_token=tokenAPI&instance=instance_number")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()