Update Address
Change or modify an address.
To clear a field, set it to an empty string.
Code Samples
.NET
using System; using System.Text.Json; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { var requestObj = new { line_2 = "Apt. 34" }; string address_id = "address_27833f1b6d463a65bef7694a35facaad"; string request = JsonSerializer.Serialize(requestObj); string result = RapydApiRequestSample.Utilities.MakeRequest("POST", $"/v1/addresses/{address_id}", request); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Error completing request: " + e.Message); } } } }
JavaScript
const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest; async function main() { try { const body = { line_2: 'Apt. 34' }; const result = await makeRequest( 'POST', '/v1/addresses/address_80923fd28383ea14c127f9ea9997a0ec', body ); console.log(result); } catch (error) { console.error('Error completing request', error); } }
PHP
<?php $path = $_SERVER['DOCUMENT_ROOT']; $path .= "/<path-to-your-utility-file>/utilities.php"; include($path); $body = [ "line_2" =>"Apt. 34" ]; try { $object = make_request('post', "/v1/addresses/address_3e5ee33a65805dae26f56f45d6d5c79e", $body); var_dump($object); } catch(Exception $e) { echo "Error =>$e"; } ?>
Python
from pprint import pprint from utilities import make_request address = { "metadata": { "merchant_defined": "updated" }, "line_2": "Apt. 56" } result = make_request(method='post', path='/v1/addresses/address_211814f6e85b112fe786b87140f10f0e', body=address) pprint(result)
/v1/addresses/:address
Update Address
curl -X post https://sandboxapi.rapyd.net/v1/addresses/address_71f1048a5837feb31b594f9d3d9b6623 -H 'access_key: your-access-key-here' -H 'Content-Type: application/json' -H 'idempotency: your-idempotency-parameter-here' -H 'salt: your-random-string-here' -H 'signature: your-calculated-signature-here' -H 'timestamp: your-unix-timestamp-here' -d '{ "metadata": { "merchant_defined": "updated" }, "line_2": "Apt. 56" } '
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "ed3f4753-b1af-4a43-8745-fef9900b39fb" }, "data": { "id": "address_71f1048a5837feb31b594f9d3d9b6623", "name": "John Doe", "line_1": "123 State Street", "line_2": "Apt. 56", "line_3": "", "city": "Anytown", "state": "NY", "country": "US", "zip": "12345", "phone_number": "12125559999", "metadata": { "merchant_defined": true }, "canton": "", "district": "", "created_at": 1551689479 } }