メニュー

Expand
ページを評価:

Sync MapItem Resource

A Sync MapItem is an individual item that belongs to one or more of your Sync Maps. See the full API reference documentation for the Sync Map resource here.

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

Sync MapItems:

  • can be inserted, updated, removed and iterated
  • are limited to 16KB of data

Sync MapItem properties

Resource Properties in REST API format
key
文字列 PII MTL: 30 DAYS

The unique, user-defined key for the Map Item.

account_sid
sid<AC> Not PII

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

service_sid
sid<IS> Not PII

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

map_sid
sid<MP> Not PII

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

url
url Not PII

The absolute URL of the Map Item resource.

revision
文字列 Not PII

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

data
オブジェクト PII MTL: 7 DAYS

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

date_expires
date_time<iso8601> Not PII

The date and time in GMT when the Map Item expires and will be deleted, specified in ISO 8601 format. If the Map Item does not expire, this value is null. The Map Item 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
文字列 PII MTL: 30 DAYS

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

Create a MapItem resource

post
https://sync.twilio.com/v1/Services/{ServiceSid}/Maps/{MapSid}/Items
パラメーター
Parameters in REST API format
service_sid
Path
post sid_like<IS> Not PII

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

map_sid
Path
post sid_like<MP> Not PII

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

key
必須
post 文字列 PII MTL: 30 DAYS

The unique, user-defined key for the Map Item. Can be up to 320 characters long.

data
必須
post オブジェクト PII MTL: 7 DAYS

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

ttl
オプション
post integer Not PII

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

item_ttl
オプション
post integer Not PII

How long, in seconds, before the Map 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 Map Item does not expire. The Map 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
オプション
post integer Not PII

How long, in seconds, before the Map Item's parent Sync Map 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 Map does not expire. The Sync Map will be deleted automatically after it expires, but there can be a delay between the expiration time and the resources's deletion.

例 1
        
        
        
        
        例 2
              
              
              
              
              Use the set method

              Add JSON to a Map

              Use the set method

              Please note: You can also use the set method to update data in existing JSON data in a Map. However, using set will overwrite any existing data in a MapItem.

              例 3
                    
                    
                    
                    
                    Note that there are two separate events for map item adds and map item updates:

                    Subscribe to a MapItem addition with the JavaScript SDK

                    Note that there are two separate events for map item adds and map item updates:

                    Fetch a MapItem resource

                    GET
                    https://sync.twilio.com/v1/Services/{ServiceSid}/Maps/{MapSid}/Items/{Key}
                    パラメーター
                    Parameters in REST API format
                    service_sid
                    Path
                    GET sid_like<IS> Not PII

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

                    map_sid
                    Path
                    GET sid_like<MP> Not PII

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

                    key
                    Path
                    GET 文字列 PII MTL: 30 DAYS

                    The key value of the Sync Map Item resource to fetch.

                    例 1
                          
                          
                          
                          
                          Request a MapItem by the key you defined when you created the item

                          Fetch a MapItem with the REST API

                          Request a MapItem by the key you defined when you created the item
                          例 2
                                
                                
                                
                                
                                Fetches by a specific key

                                Read all MapItem resources

                                GET
                                https://sync.twilio.com/v1/Services/{ServiceSid}/Maps/{MapSid}/Items

                                MapItem read access is performed using the key that provided as an arbitrary string to identify the item.

                                By default, this will return the first 50 MapItems. Supply a PageSize parameter to fetch up to 100 items at once. See paging for more information.

                                パラメーター
                                Parameters in REST API format
                                service_sid
                                Path
                                GET sid_like<IS> Not PII

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

                                map_sid
                                Path
                                GET sid_like<MP> Not PII

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

                                order
                                オプション
                                GET enum:query_result_order Not PII

                                How to order the Map Items returned by their key value. Can be: asc (ascending) or desc (descending) and the default is ascending. Map Items are ordered lexicographically by Item key.

                                from
                                オプション
                                GET 文字列 Not PII

                                The key of the first Sync Map Item resource to read. See also bounds.

                                bounds
                                オプション
                                GET enum:query_from_bound_type Not PII

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

                                例 1
                                      
                                      
                                      
                                      
                                      例 2
                                            
                                            
                                            
                                            
                                            例 3
                                                  
                                                  
                                                  
                                                  
                                                  This code sample displays the first item.

                                                  Get all MapItems with the JavaScript SDK

                                                  This code sample displays the first item.

                                                  Update a MapItem resource

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

                                                  MapItem update access is performed using the key that provided as an arbitrary string to identify the item.

                                                  パラメーター
                                                  Parameters in REST API format
                                                  service_sid
                                                  Path
                                                  post sid_like<IS> Not PII

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

                                                  map_sid
                                                  Path
                                                  post sid_like<MP> Not PII

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

                                                  key
                                                  Path
                                                  post 文字列 PII MTL: 30 DAYS

                                                  The key value of the Sync Map Item resource to update.

                                                  data
                                                  オプション
                                                  post オブジェクト PII MTL: 7 DAYS

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

                                                  ttl
                                                  オプション
                                                  post integer Not PII

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

                                                  item_ttl
                                                  オプション
                                                  post integer Not PII

                                                  How long, in seconds, before the Map 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 Map Item does not expire. The Map 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
                                                  オプション
                                                  post integer Not PII

                                                  How long, in seconds, before the Map Item's parent Sync Map 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 Map does not expire. This parameter can only be used when the Map Item's data or ttl is updated in the same request. The Sync Map will be deleted automatically after it expires, but there can be a delay between the expiration time and the resources's deletion.

                                                  if_match
                                                  ヘッダー
                                                  post 文字列 Not PII

                                                  The If-Match HTTP request header

                                                  例 1
                                                        
                                                        
                                                        
                                                        
                                                        例 2
                                                              
                                                              
                                                              
                                                              
                                                              例 3
                                                                    
                                                                    
                                                                    
                                                                    
                                                                    Use the update method to change the data in a Map Item

                                                                    Update data in a MapItem with the JavaScript SDK

                                                                    Use the update method to change the data in a Map Item
                                                                    例 4
                                                                          
                                                                          
                                                                          
                                                                          
                                                                          Use mutate for more fine-grained control over updates.

                                                                          Mutate data in a MapItem using the JavaScript SDK

                                                                          Use mutate for more fine-grained control over updates.

                                                                          For more details on mutate and conflict resolution read up on Mutation and Conflict Resolution.

                                                                          例 5
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                Note that there are two separate events for map item adds and map item updates:

                                                                                Subscribe to a MapItem update with the JavaScript SDK

                                                                                Note that there are two separate events for map item adds and map item updates:

                                                                                Delete a MapItem resource

                                                                                削除する
                                                                                https://sync.twilio.com/v1/Services/{ServiceSid}/Maps/{MapSid}/Items/{Key}

                                                                                Permanently delete a specific item from an existing Map.

                                                                                パラメーター
                                                                                Parameters in REST API format
                                                                                service_sid
                                                                                Path
                                                                                削除する sid_like<IS> Not PII

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

                                                                                map_sid
                                                                                Path
                                                                                削除する sid_like<MP> Not PII

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

                                                                                key
                                                                                Path
                                                                                削除する 文字列 PII MTL: 30 DAYS

                                                                                The key value of the Sync Map Item resource to delete.

                                                                                if_match
                                                                                ヘッダー
                                                                                削除する 文字列 Not PII

                                                                                The If-Match HTTP request header

                                                                                例 1
                                                                                      
                                                                                      
                                                                                      
                                                                                      
                                                                                      例 2
                                                                                            
                                                                                            
                                                                                            
                                                                                            
                                                                                            例 3
                                                                                                  
                                                                                                  
                                                                                                  
                                                                                                  
                                                                                                  Deletes the item with key "Taylor"

                                                                                                  Delete a single MapItem with the JavaScript SDK

                                                                                                  Deletes the item with key "Taylor"
                                                                                                  ページを評価:

                                                                                                  ヘルプが必要ですか?

                                                                                                  誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。

                                                                                                        
                                                                                                        
                                                                                                        

                                                                                                        フィードバックくださりありがとうございます!

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

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

                                                                                                        Thanks for your feedback!

                                                                                                        Refer us and get $10 in 3 simple steps!

                                                                                                        ステップ1

                                                                                                        Get link

                                                                                                        Get a free personal referral link here

                                                                                                        ステップ2:

                                                                                                        Give $10

                                                                                                        Your user signs up and upgrade using link

                                                                                                        ステップ3

                                                                                                        Get $10

                                                                                                        1,250 free SMSes
                                                                                                        OR 1,000 free voice mins
                                                                                                        OR 12,000 chats
                                                                                                        OR more