3.5 Check Error Handling on Accounts
Using API
See https://coupadocs.atlassian.net/wiki/display/integrate/Accounts.
The following samples show failure scenarios:
Sample API 1 - Updating account type value
PUT
https:// <instance>/api/accounts/:account_id
Payload
<?xml version="1.0" encoding="UTF-8"?> <account> <account-type> <name>Ace Corporate123</name> </account-type> </account>
Error message: Unable to find valid AccountType record for account_type with keys {"name"=>"Ace Corporate123"}. Possible keys are ["id", "name"]. Please verify your xml.
This error occurs due to an invalid Account type value in the system.
Sample API 2 - Updating code for account
PUT
https:// <instance>/api/accounts/:account_id
Payload
<?xml version="1.0" encoding="UTF-8"?> <account> <code>test7-test8-test-10</code> </account>
Error message: No error message. It shows 200 success but it does not update the code as the segment needs to be updated for updating the code.
Sample API 3 - Fetching accounts xml
PUT
https:// <instance>/api/accounts/:account_id
GET
X-COUPA-API-KEY: c34752e926651ca0b434de4c151903b465fead2a1
ACCEPT
application/xml
Error: 401: Unauthorized
This error occurs due to an incorrect API key.
Using CSV
For info on values to be used and required fields, see https://coupadocs.atlassian.net/wiki/display/integrate/Accounts
Note that custom fields are not part of the documentation, and updating custom field data depends on their configuration. For example, if a custom field on an Account is required, passing that field as blank during creating a new Account gives an error message without creating the Account.