Account: Update

This method allows you to update an Infobip account.

Resource

https://api.infobip.com/settings/1/accounts/:key

Parameters

Property name Type Description
key* string Key used to uniquely identify the account.
name string Account name.
enabled boolean Status of account (enabled/disabled).

Request Example

					PUT settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24 HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
 
{
  "name": "UpdatedName",
  "enabled": false
}
					
				
					POST settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24 HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/xml
Accept: application/xml

<Account>
  <name>UpdatedName</name>
  <enabled>false</enabled>
</Account>
					
				
					curl -X PUT -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" -H "Content-Type: application/json" -d '{
    "name": "UpdatedName",
    "enabled": false
}' 'https://api.infobip.com/settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24'
					
				
					<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.infobip.com/settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "{\n    \"name\": \"UpdatedName\",\n    \"enabled\": false\n}",
  CURLOPT_HTTPHEADER => array(
    "authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
					
				
					require 'uri'
require 'net/http'

url = URI("https://api.infobip.com/settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Put.new(url)
request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
request["content-type"] = 'application/json'
request.body = "{\r\n    \"name\": \"UpdatedName\",\r\n    \"enabled\": false\r\n}"

response = http.request(request)
puts response.read_body
					
				
					import http.client

conn = http.client.HTTPSConnection("api.infobip.com")

payload = "{\r\n    \"name\": \"UpdatedName\",\r\n    \"enabled\": false\r\n}"

headers = {
    'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    'content-type': "application/json",
    }

conn.request("PUT", "settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
					
				
					HttpResponse<String> response = Unirest.put("https://api.infobip.com/settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24")
  .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
  .header("content-type", "application/json")
  .body("{\r\n    \"name\": \"UpdatedName\",\r\n    \"enabled\": false\r\n}")
  .asString();
					
				
					var client = new RestClient("https://api.infobip.com/settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24");
var request = new RestRequest(Method.PUT);
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
request.AddParameter("application/json", "{\r\n    \"name\": \"UpdatedName\",\r\n    \"enabled\": false\r\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
					
				
					var data = JSON.stringify({
  "name": "UpdatedName",
  "enabled": false
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.infobip.com/settings/1/accounts/EF04794F718A3FC8C6DFA0B215B2CF24");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);
					
				

Response

					{
  "key": "EF04794F718A3FC8C6DFA0B215B2CF24",  
  "ownerKey": "28A3FC8C615B2CF24E1DFA0BF04794F7",
  "name": "UpdatedName",
  "enabled": false
}
					
				
					&lt;?xml version='1.0' encoding='UTF-8'?&gt;
<account>
  	<key>EF04794F718A3FC8C6DFA0B215B2CF24</key>
    <ownerKey>28A3FC8C615B2CF24E1DFA0BF04794F7</ownerKey>
    <name>UpdatedName</name>
    <enabled>false</enabled>
</account>
					
				
					{
  "requestError": {
    "serviceException": {
      "messageId": "BAD_REQUEST",
      "text": "Bad request"
    }
  }
}
					
				

Response format

If successful, the response header HTTP status code will be 200 OK and the account will be updated.

If you try to update the account without authorization, you will receive a 401 Unauthorized error.

Account

Parameter Type Description
key String Key used to uniquely identify the account.
ownerKey String Key which uniquely identifies account’s owner.
name String Account name.
enabled Boolean Whether account is enabled for use.