Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now

Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

ListItem resource

A Sync ListItem is an object you have added to a Sync List.

You need to create a List first before you can use this resource to create, read, update, and delete items.

Sync Lists generally behave like arrays in most programming languages, but when working with ListItems keep these details in mind:

  • Items can be appended, updated, removed and iterated, but not inserted at random position.
  • Each item is limited to 16KB of data.
  • Item read or update access is performed using an item index that is internally generated.
  • The index is not guaranteed to be contiguous.
  • Full list modification history is maintained with every change triggering new revision.
  • Strict ordering of all list mutation events and all contained items is guaranteed.
  • Lists expire and are deleted automatically, if you included a TTL parameter when creating your List. By default, a List and its items are persisted permanently.

ListItem properties

Names in PHP format
index
integer Not PII

The automatically generated index of the List Item. The index values of the List Items in a Sync List can have gaps in their sequence.

accountSid
sid<AC> Not PII

The SID of the Account that created the List Item resource.

serviceSid
sid<IS> Not PII

The SID of the Sync Service the resource is associated with.

listSid
sid<ES> Not PII

The SID of the Sync List that contains the List Item.

url
url Not PII

The absolute URL of the List Item resource.

revision
string Not PII

The current revision of the item, represented as a string.

data

An arbitrary, schema-less object that the List Item stores. Can be up to 16KB in length.

dateExpires
date_time<iso8601> Not PII

The date and time in GMT when the List Item expires and will be deleted, specified in ISO 8601 format. If the List Item does not expire, this value is null. The List Item resource might not be deleted immediately after it expires.

dateCreated
date_time<iso8601> Not PII

The date and time in GMT when the resource was created specified in ISO 8601 format.

dateUpdated
date_time<iso8601> Not PII

The date and time in GMT when the resource was last updated specified in ISO 8601 format.

createdBy

The identity of the List Item's creator. If the item is created from the client SDK, the value matches the Access Token's identity field. If the item was created from the REST API, the value is system.

Create a ListItem resource

post
https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{ListSid}/Items
Parameters
Names in None format
service_sid
Required
post sid_like<IS> Not PII

The SID of the Sync Service to create the new List Item in.

list_sid
Required
post sid_like<ES> Not PII

The SID of the Sync List to add the new List Item to. Can be the Sync List resource's sid or its unique_name.

data
Required
post object PII MTL: 7 DAYS

A JSON string that represents an arbitrary, schema-less object that the List Item stores. Can be up to 16KB in length.

ttl
Optional
post integer Not PII

An alias for item_ttl. If both parameters are provided, this value is ignored.

item_ttl
Optional
post integer Not PII

How long, in seconds, before the List Item expires (time-to-live) and is deleted. Can be an integer from 0 to 31,536,000 (1 year). The default value is 0, which means the List Item does not expire. The List Item will be deleted automatically after it expires, but there can be a delay between the expiration time and the resources's deletion.

collection_ttl
Optional
post integer Not PII

How long, in seconds, before the List Item's parent Sync List expires (time-to-live) and is deleted. Can be an integer from 0 to 31,536,000 (1 year). The default value is 0, which means the parent Sync List does not expire. The Sync List will be deleted automatically after it expires, but there can be a delay between the expiration time and the resources's deletion.

Example
        
        
        
        

        Fetch a ListItem resource

        get
        https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{ListSid}/Items/{Index}
        Parameters
        Names in None format
        service_sid
        Required
        get sid_like<IS> Not PII

        The SID of the Sync Service with the Sync List Item resource to fetch.

        list_sid
        Required
        get sid_like<ES> Not PII

        The SID of the Sync List with the Sync List Item resource to fetch. Can be the Sync List resource's sid or its unique_name.

        index
        Required
        get integer Not PII

        The index of the Sync List Item resource to fetch.

        Example
              
              
              
              

              Read a ListItem resource

              get
              https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{ListSid}/Items

              Retrieve all items belonging to a List.

              By default, this will return the first 50 List items. Supply a PageSize argument to fetch up to 100 items at once.

              See paging for more information.

              Parameters
              Names in None format
              service_sid
              Required
              get sid_like<IS> Not PII

              The SID of the Sync Service with the List Item resources to read.

              list_sid
              Required
              get sid_like<ES> Not PII

              The SID of the Sync List with the List Items to read. Can be the Sync List resource's sid or its unique_name.

              order
              Optional
              get enum:query_result_order Not PII

              How to order the List Items returned by their index value. Can be: asc (ascending) or desc (descending) and the default is ascending.

              from
              Optional
              get string Not PII

              The index of the first Sync List Item resource to read. See also bounds.

              bounds
              Optional
              get enum:query_from_bound_type Not PII

              Whether to include the List Item referenced by the from parameter. Can be: inclusive to include the List Item referenced by the from parameter or exclusive to start with the next List Item. The default value is inclusive.

              Example
                    
                    
                    
                    

                    Update a ListItem resource

                    post
                    https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{ListSid}/Items/{Index}
                    Parameters
                    Names in None format
                    service_sid
                    Required
                    post sid_like<IS> Not PII

                    The SID of the Sync Service with the Sync List Item resource to update.

                    list_sid
                    Required
                    post sid_like<ES> Not PII

                    The SID of the Sync List with the Sync List Item resource to update. Can be the Sync List resource's sid or its unique_name.

                    index
                    Required
                    post integer Not PII

                    The index of the Sync List Item resource to update.

                    data
                    Optional
                    post object PII MTL: 7 DAYS

                    A JSON string that represents an arbitrary, schema-less object that the List Item stores. Can be up to 16KB in length.

                    ttl
                    Optional
                    post integer Not PII

                    An alias for item_ttl. If both parameters are provided, this value is ignored.

                    item_ttl
                    Optional
                    post integer Not PII

                    How long, in seconds, before the List Item expires (time-to-live) and is deleted. Can be an integer from 0 to 31,536,000 (1 year). The default value is 0, which means the List Item does not expire. The List Item will be deleted automatically after it expires, but there can be a delay between the expiration time and the resources's deletion.

                    collection_ttl
                    Optional
                    post integer Not PII

                    How long, in seconds, before the List Item's parent Sync List expires (time-to-live) and is deleted. Can be an integer from 0 to 31,536,000 (1 year). The default value is 0, which means the parent Sync List does not expire. The Sync List will be deleted automatically after it expires, but there can be a delay between the expiration time and the resources's deletion.

                    Example
                          
                          
                          
                          

                          Delete a ListItem resource

                          delete
                          https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{ListSid}/Items/{Index}
                          Parameters
                          Names in None format
                          service_sid
                          Required
                          delete sid_like<IS> Not PII

                          The SID of the Sync Service with the Sync List Item resource to delete.

                          list_sid
                          Required
                          delete sid_like<ES> Not PII

                          The SID of the Sync List with the Sync List Item resource to delete. Can be the Sync List resource's sid or its unique_name.

                          index
                          Required
                          delete integer Not PII

                          The index of the Sync List Item resource to delete.

                          Example
                                
                                
                                
                                
                                Rate this page:

                                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 browsing the Twilio tag on Stack Overflow.