post
https://sandbox-api.viantinc.com/{basePath}/agency/save
Creates or modifies an agency.
Request
POST /agency/save
Request Contents
| Name | Type | Description | Required |
|---|---|---|---|
| id | Number | Agency ID | Required for update. |
| name | String | Agency name | Yes |
| contact_name | String | Contact name | Yes |
| street | String | Street address | Yes |
| city | String | City | Yes |
| state | String | State | Yes |
| zip | String | Zip/Postal Code | Yes |
| country | String | Country | Yes |
| phone | String | Phone | Yes |
| fax | String | Fax | Yes |
| String | Yes | ||
| description | String | Description | Yes |
| externalAgencyId | String | External ID for the Agency | No |
Response Contents
| Name | Type | Description |
|---|---|---|
| messages | Object Array | An array of any error messages. |
| messages[].level | String | Error level. |
| messages[].code | String | Error code. |
| messages[].message | String | Error message. |
| entity | Object | An agency object. |
| entity.id | Number | Agency ID. |
| entity.name | String | Agency name. |
| entity.contact_name | String | Contact name |
| entity.street | String | Street address |
| entity.city | String | City |
| entity.state | String | State |
| entity.zip | String | Zip/Postal code |
| entity.country | String | Country |
| entity.phone | String | Phone |
| entity.fax | String | Fax |
| entity.email | String | |
| entity.description | String | Description |
| entity.externalAgencyId | String | External ID for the Agency |
Examples
Request to create an agency
Since the ID field is omitted, this example creates a new agency.
curl -u \<user>:\<password> -X POST -H "Content-Type: application/json" -d '\{ "name" : "My new agency", "contact\_name": "John Smith", "street": "123 Any St", "city": "New York", "state": "NY", "zip": "10018", "country": "USA", "phone": "555-555-5555", "fax": "444-444-4444", "email": "[email protected]", "description": "This is my new agency", "externalAgencyId": "abc#1234"}' https://sandbox-api.viant.com/v1/agency/save
JSON Response
{
"messages": [],
"entity": {
"id": 3318,
"name": "My new agency",
"contact_name": "John Smith",
"street": "123 Any St",
"city": "New York",
"state": "NY",
"zip": "10018",
"country": "USA",
"phone": "555-555-5555",
"fax": "444-444-4444",
"email": "[email protected]",
"description": "This is my new agency",
"externalAgencyId": "abc#1234"
}
}
Request to edit an agency
This example uses the agency ID to change the name of the agency.
curl -u \<user>:\<password> -X POST -H "Content-Type: application/json" -d '\{"id": 3318, "name" : "My best agency", "contact\_name": "John Smith", "street": "123 Any St", "city": "New York", "state": "NY", "zip": "10018", "country": "USA", "phone": "555-555-5555", "fax": "444-444-4444", "email": "[email protected]", "description": "This is my best agency", "externalAgencyId": "abc$1234"}' https://sandbox-api.viant.com/v1/agency/save
Response
{
"messages": [],
"entity": {
"id": 3318,
"name": "My best agency",
"contact_name": "John Smith",
"street": "123 Any St",
"city": "New York",
"state": "NY",
"zip": "10018",
"country": "USA",
"phone": "555-555-5555",
"fax": "444-444-4444",
"email": "[email protected]",
"description": "This is my best agency",
"externalAgencyId": "abc$1234"
}
}