List Resource
A Sync List is an ordered collection of individual items, each storing separate JSON objects. Use Lists to push JSON into an ordered list and update existing items within the list.
After you create a List, you can add, retrieve, update, and delete items from your List with the ListItem resource. (That page contains more details on how items are stored in lists, including ordering, expiration, and limitations on each item's size.)
Lists can be created, updated, subscribed to and removed via the client JavaScript SDK. Servers wishing to manage these objects can do so via the REST API using the examples below.
List properties
Resource Properties in REST API format | |
---|---|
sid
|
The unique string that we created to identify the Sync List resource. |
unique_name
|
An application-defined string that uniquely identifies the resource. It can be used in place of the resource's |
account_sid
|
The SID of the Account that created the Sync List resource. |
service_sid
|
The SID of the Sync Service the resource is associated with. |
url
|
The absolute URL of the Sync List resource. |
links
|
The URLs of the Sync List's nested resources. |
revision
|
The current revision of the Sync List, represented as a string. |
date_expires
|
The date and time in GMT when the Sync List expires and will be deleted, specified in ISO 8601 format. If the Sync List does not expire, this value is |
date_created
|
The date and time in GMT when the resource was created specified in ISO 8601 format. |
date_updated
|
The date and time in GMT when the resource was last updated specified in ISO 8601 format. |
created_by
|
The identity of the Sync List's creator. If the Sync List is created from the client SDK, the value matches the Access Token's |
Create a List resource
https://sync.twilio.com/v1/Services/{ServiceSid}/Lists
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Sync Service to create the new Sync List in. |
unique_name
Optional
|
An application-defined string that uniquely identifies the resource. This value must be unique within its Service and it can be up to 320 characters long. The |
ttl
Optional
|
Alias for collection_ttl. If both are provided, this value is ignored. |
collection_ttl
Optional
|
How long, in seconds, before the Sync List expires (time-to-live) and is deleted. |
Example 1
Fetch a List resource
https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{Sid}
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Sync Service with the Sync List resource to fetch. |
sid
Path
|
The SID of the Sync List resource to fetch. Can be the Sync List resource's |
Example 1
Read multiple List resources
https://sync.twilio.com/v1/Services/{ServiceSid}/Lists
By default, this will return the first 50 Lists. Supply a PageSize parameter to fetch up to 100 items at once. See paging for more information.
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Sync Service with the Sync List resources to read. |
Example 1
Update a List resource
https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{Sid}
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Sync Service with the Sync List resource to update. |
sid
Path
|
The SID of the Sync List resource to update. Can be the Sync List resource's |
ttl
Optional
|
An alias for |
collection_ttl
Optional
|
How long, in seconds, before the Sync List expires (time-to-live) and is deleted. |
Example 1
Delete a List resource
https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{Sid}
Permanently delete a List along with all items belonging to it.
Parameters
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Sync Service with the Sync List resource to delete. |
sid
Path
|
The SID of the Sync List resource to delete. Can be the Sync List resource's |
Example 1
Example 2
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.