Reboot an instance

Rebooting an instance if there were problems

patch
/instance_whatsapp/reboot

https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/reboot?api_token=tokenAPI&instance=instance_number
Reboot the instance while maintaining authentication
Request
Response
Query Parameters
instance
required
string
the instance number
api_token
required
string
the api token (see the "Authentication" section)
200: OK
In "data" there is an object with a field "succes", if true the reboot is has been effected.
{
"object": "object",
"data": {
"success": true
},
"has_more": false,
"count_api": 1,
"reset_count_api": 60
}
400: Bad Request
GENERIC ERROR
500: Internal Server Error
{
"result": "error",
"message": "You can call reboot only every 5 minutes. Server started 1.93 minutes ago"
}

Example:

cURL
C#
Go
Java
NodeJs
Objective-C
PHP
Python
Ruby
Swift
curl -X PATCH \
'https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/reboot?api_token=tokenAPI&instance=instance_number'
var client = new RestClient("https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/reboot?api_token=tokenAPI&instance=instance_number");
var request = new RestRequest(Method.PATCH);
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/reboot?api_token=tokenAPI&instance=instance_number"
req, _ := http.NewRequest("PATCH", 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/reboot?api_token=tokenAPI&instance=instance_number")
.patch(null)
.build();
Response response = client.newCall(request).execute();
var request = require("request");
var options = { method: 'PATCH',
url: 'https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/reboot',
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/reboot?api_token=tokenAPI&instance=instance_number"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
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
HttpRequest::methodRegister('PATCH');
$request = new HttpRequest();
$request->setUrl('https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/reboot');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$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/reboot"
querystring = {"api_token":"tokenAPI","instance":"instance_number"}
payload = ""
response = requests.request("PATCH", url, data=payload, params=querystring)
print(response.text)
require 'uri'
require 'net/http'
url = URI("https://api.mercury.chat/sdk/v1/whatsapp/instance_whatsapp/reboot?api_token=tokenAPI&instance=instance_number")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.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/reboot?api_token=tokenAPI&instance=instance_number")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()