Get specific records by UUID

This code snippet shows you how to retrieve a specific record by specifying a message or call UUID. It is also possible to specify a comma-separated list of UUIDs to retrieve multiple records, for example:

curl -u "$VONAGE_API_KEY:$VONAGE_API_SECRET" https://api.nexmo.com/v2/reports/records?account_id=abcd1234&product=VERIFY-API&id=7b1091b8-1a05-11eb-bad9-38f9d331493,7b109636-1a05-11eb-bad9-38f9d3316493,7b109a1e-1a05-11eb-bad9-38f9d3316493,7b10a0c2-1a05-11eb-bad9-38f9d331649

If records corresponding to any of the specified UUIDs are not found, then a list of those are returned in the response using the ids_not_found field, for example:

NOTE: This is a synchronous call and so will block until it returns a response.

Example

KeyDescription
VONAGE_API_KEY

Your Vonage API key (see it on your dashboard).

VONAGE_API_SECRET

Your Vonage API secret (also available on your dashboard).

ACCOUNT_ID

The account ID (same as VONAGE_API_KEY) for the account you want to generate reports, or retrieve records for.

REPORT_DIRECTION

Either inbound or outbound

REPORT_PRODUCT

Specifies the product for which reports and records are obtained. Can be one of SMS, VOICE-CALL, WEBSOCKET-CALL, VERIFY-API, NUMBER-INSIGHT, MESSAGES, CONVERSATIONS, or ASR.

ID

The UUID of the message or call to retrieve a record for. It is possible to specify a comma-separated list of UUIDs to retrieve multiple records.

Write the code

Add the following to load-records-sync-id.sh:

View full source

Run your code

Save this file to your machine and run it:

bash load-records-sync-id.sh

Try it out

  1. Set the replaceable variables for your account.

  2. For this example, set REPORT_PRODUCT to SMS.

  3. Using the table as a guide set values for the remaining variables.

  4. Run the script and you receive a response similar to the following:

See also