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

Contains the automatically generated index of this List Item. Positive integer or zero, guaranteed to be always incrementing. Not guaranteed to be contiguous; the list may have gaps as items are deleted.

accountSid
sid<AC> Not PII

The unique SID identifier of the Twilio Account.

serviceSid
sid<IS> Not PII

The unique SID identifier of the Service Instance that hosts this List object.

listSid
sid<ES> Not PII

The unique 34-character SID identifier of the List containing this Item.

url
url Not PII

The absolute URL for this item.

revision
string Not PII

Contains the current revision of this item, represented by a string identifier.

data

Contains arbitrary user-defined, schema-less data that this List Item stores, represented by a JSON object, up to 16KB.

dateExpires
date_time<iso8601> Not PII

Contains the date this item expires and gets deleted automatically. Contains null if the List persists permanently.

dateCreated
date_time<iso8601> Not PII

The date this item was created, given in UTC ISO 8601 format.

dateUpdated
date_time<iso8601> Not PII

Specifies the date this item was last updated, given in UTC ISO 8601 format.

createdBy

The identity of this item's creator. If the List is created from the client SDK, the value matches the Access Token's identity field. If the List 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
data
Required
post object PII MTL: 7 DAYS

Contains arbitrary user-defined, schema-less data that this List Item stores, represented by a JSON object, up to 16KB.

ttl
Optional
post integer Not PII

Alias for item_ttl. If both are provided, this value is ignored.

item_ttl
Optional
post integer Not PII

Time-to-live of this item in seconds, defaults to no expiration. In the range [1, 31 536 000 (1 year)], or 0 for infinity. Upon expiry, the list item will be cleaned up at least in a matter of hours, and often within seconds, making this a good tool for garbage management.

collection_ttl
Optional
post integer Not PII

Time-to-live of this item's parent List in seconds, defaults to no expiration. In the range [1, 31 536 000 (1 year)], or 0 for infinity. This parameter can only be used when the list item's data or ttl is updated in the same request.

Example
        
        
        
        

        Fetch a ListItem resource

        get
        https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{ListSid}/Items/{Index}
        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
              order
              Optional
              get enum:query_result_order Not PII

              A string; asc or desc

              from
              Optional
              get string Not PII

              An integer representing Item index offset (inclusive). If not present, query is performed from the start or end, depending on the Order query parameter.

              Example
                    
                    
                    
                    

                    Update a ListItem resource

                    post
                    https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{ListSid}/Items/{Index}
                    Parameters
                    Names in None format
                    data
                    Optional
                    post object PII MTL: 7 DAYS

                    Contains arbitrary user-defined, schema-less data that this List Item stores, represented by a JSON object, up to 16KB.

                    ttl
                    Optional
                    post integer Not PII

                    Alias for item_ttl. If both are provided, this value is ignored.

                    item_ttl
                    Optional
                    post integer Not PII

                    Time-to-live of this item in seconds, defaults to no expiration. In the range [1, 31 536 000 (1 year)], or 0 for infinity. Upon expiry, the list item will be cleaned up at least in a matter of hours, and often within seconds, making this a good tool for garbage management.

                    collection_ttl
                    Optional
                    post integer Not PII

                    Time-to-live of this item's parent List in seconds, defaults to no expiration. In the range [1, 31 536 000 (1 year)], or 0 for infinity. This parameter can only be used when the list item's data or ttl is updated in the same request.

                    Example
                          
                          
                          
                          

                          Delete a ListItem resource

                          delete
                          https://sync.twilio.com/v1/Services/{ServiceSid}/Lists/{ListSid}/Items/{Index}
                          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.