Update the account details

Updates the Account object by setting the values of the parameters passed. Parameters which are not provided will remain unchanged.

This request accepts only the name, city, state, timezone and address as parameters.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/

Arguments

address string

Postal address of the account which will be displayed in the invoices.

name string

Name of the account holder.

city string

City of the account holder.

state string

State or region of the account.

timezone string

The time zone used in the Plivo dashboard for this account. A list of possible time zone values is maintained at the IANA Time Zone Database.

Returns

Returns a confirmation that the object is updated.

Response

HTTP Status Code: 202

{
  "api_id": "02bbdbaa-9303-11e7-8bc8-065f6a74a84a",
  "message": "changed"
}

Example Request

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import plivo

client = plivo.RestClient()
response = client.account.update(
    name='Lucius Fox',
    city='New York',
    address='Times Square', )
print(response)

# Or, you could use the Application object
account_details = client.account.get()
response = account_details.update(
    name='Lucius Fox',
    city='New York',
    address='Times Square', )
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Example for Account Update
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN")

begin
  response = api.account.update(
    city: 'Bengaluru',
    name: 'Test Account',
    address: 'Test Address'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Example for Account update

var plivo = require('plivo');

(function main() {
    'use strict';
    
    // As the auth_id and auth_token are unspecified, Plivo will fetch them from the PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN environment variables.
    var client = new plivo.Client();
    client.accounts.update(
        {
            name: "Test Account",
            city: "Bengaluru",
            address: "Test Address",
        },
    ).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
/**
 * Example for Account update
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");

try {
    $response = $client->accounts->update(
        'Test Account',
        'Bengaluru',
        'Test Address'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r(ex);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.plivo.api.samples.account;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.account.Account;
import com.plivo.api.models.account.AccountUpdateResponse;

/**
* Example for Account update
*/
class AccountUpdate {
    public static void main(String [] args) {
        Plivo.init();
        try {
            AccountUpdateResponse response = Account.updater()
                .name("Test Account")
                .city("Bengaluru")
                .address("Test Address")
                .update();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
 * Example for Account Update
 */
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var api = new PlivoApi("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");
            try
            {
                var response = api.Account.Update(
                    city:"Bengaluru",
                    name:"Test Account",
                    address:"Test Address"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}
1
2
3
4
5
6
7
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"name": "John Smith",
         "city": "San Francisco",
         "address": "123 Main St",
         "timezone": "America/Los_Angeles"}' \
    https://api.plivo.com/v1/Account/{auth_id}/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Example for Account update
package main

import "fmt"
import "github.com/plivo/plivo-go"
 
func main() {
	client, err := plivo.NewClient("", "", &plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}
	response, err := client.Accounts.Update(
		plivo.AccountUpdateParams{
			Name: "Test Account",
			City: "Bengaluru",
			Address: "Test Address",
		},
	)
	if err != nil {
		panic(err)
	}
	fmt.Printf("Response: %#v\n", response)
}