Menu

Expand
Rate this page:

Map Resource

A Sync Map stores unordered JSON objects accessible via a developer-defined key. It is an unordered collection of individual Map items.

After you create a Map, use the MapItem resource to add, retrieve, update, and delete items from your Map.

A few notes about Sync Maps:

  • Full map modification history persists with every change that triggers a new revision.
  • Strict ordering of map mutation events is guaranteed, but the map item order is not defined.
  • By default, data persists permanently, but maps will expire and be deleted automatically if eviction is configured via the TTL parameter.

Maps 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.

Map properties

Each Map object root resource has the following properties.

Unique name and expiration date attributes are optional and may be null.

Resource Properties in REST API format
sid
sid<MP> Not PII

The unique string that we created to identify the Sync Map resource.

unique_name

An application-defined string that uniquely identifies the resource. It can be used in place of the resource's sid in the URL to address the resource.

account_sid
sid<AC> Not PII

The SID of the Account that created the Sync Map resource.

service_sid
sid<IS> Not PII

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

url
url Not PII

The absolute URL of the Sync Map resource.

links
uri_map Not PII

The URLs of the Sync Map's nested resources.

revision
string Not PII

The current revision of the Sync Map, represented as a string.

date_expires
date_time<iso8601> Not PII

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

date_created
date_time<iso8601> Not PII

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

date_updated
date_time<iso8601> Not PII

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

created_by

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

Create a SyncMap resource

post
https://sync.twilio.com/v1/Services/{ServiceSid}/Maps

Create a new Map in this Service Instance, optionally giving it a unique name and assigning an expiration deadline.

Parameters
Parameters in REST API format
service_sid
Path
post sid_like<IS> Not PII

The SID of the Sync Service to create the Sync Map in.

unique_name
Optional
post string PII MTL: 30 DAYS

An application-defined string that uniquely identifies the resource. It can be used as an alternative to the sid in the URL path to address the resource.

ttl
Optional
post integer Not PII

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

collection_ttl
Optional
post integer Not PII

How long, in seconds, before the Sync Map expires (time-to-live) and is deleted.

Example 1
Loading Code Sample...
        
        

        Create a Map

        Example 2
        Loading Code Sample...
              
              

              Create a Map with a unique name

              Example 3
              Loading Code Sample...
                    
                    
                    Set TTL (in seconds) for expiring this Map instance

                    Create a Map with an expiration deadline

                    Set TTL (in seconds) for expiring this Map instance

                    Fetch a SyncMap resource

                    get
                    https://sync.twilio.com/v1/Services/{ServiceSid}/Maps/{Sid}
                    Parameters
                    Parameters in REST API format
                    service_sid
                    Path
                    get sid_like<IS> Not PII

                    The SID of the Sync Service with the Sync Map resource to fetch.

                    sid
                    Path
                    get sid_like<MP> Not PII

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

                    Example 1
                    Loading Code Sample...
                          
                          

                          Fetch Sync Map

                          Read multiple SyncMap resources

                          get
                          https://sync.twilio.com/v1/Services/{ServiceSid}/Maps

                          Retrieve a list of all Maps belonging to this Service Instance.

                          By default, this will return the first 50 Maps. 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
                          get sid_like<IS> Not PII

                          The SID of the Sync Service with the Sync Map resources to read.

                          Example 1
                          Loading Code Sample...
                                
                                

                                Read Sync Map

                                Update a SyncMap resource

                                post
                                https://sync.twilio.com/v1/Services/{ServiceSid}/Maps/{Sid}
                                Parameters
                                Parameters in REST API format
                                service_sid
                                Path
                                post sid_like<IS> Not PII

                                The SID of the Sync Service with the Sync Map resource to update.

                                sid
                                Path
                                post sid_like<MP> Not PII

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

                                ttl
                                Optional
                                post integer Not PII

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

                                collection_ttl
                                Optional
                                post integer Not PII

                                How long, in seconds, before the Sync Map expires (time-to-live) and is deleted.

                                Example 1
                                Loading Code Sample...
                                      
                                      

                                      Update Sync Map

                                      Delete a Sync Map resource

                                      delete
                                      https://sync.twilio.com/v1/Services/{ServiceSid}/Maps/{Sid}

                                      Permanently delete a specific Map along with all items belonging to it from a given Sync Service Instance.

                                      Parameters
                                      Parameters in REST API format
                                      service_sid
                                      Path
                                      delete sid_like<IS> Not PII

                                      The SID of the Sync Service with the Sync Map resource to delete.

                                      sid
                                      Path
                                      delete sid_like<MP> Not PII

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

                                      Example 1
                                      Loading Code Sample...
                                            
                                            

                                            Delete a Map with the REST API

                                            Example 2
                                            Loading Code Sample...
                                                  
                                                  

                                                  Delete a Map with the JavaScript SDK

                                                  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 by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                                                  Loading Code Sample...
                                                        
                                                        
                                                        

                                                        Thank you for your feedback!

                                                        Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                                                        Sending your feedback...
                                                        🎉 Thank you for your feedback!
                                                        Something went wrong. Please try again.

                                                        Thanks for your feedback!

                                                        thanks-feedback-gif