Latest Legacy

Update the account details

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

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

API Endpoint

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

Arguments

address string

Postal address of the account, which is displayed on 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('<auth_id>','<auth_token>')
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("<auth_id>","<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';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    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("<auth_id>","<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("<auth_id>","<auth_token>");
        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("<auth_id>","<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
24
25
26
27
28
// Example for Account update
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Accounts.Update(
		plivo.AccountUpdateParams{
			Name:    "Test Account",
			City:    "Bengaluru",
			Address: "Test Address",
		},
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}