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
|
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 |
account_sid
|
The SID of the Account that created the Sync Map resource. |
service_sid
|
The SID of the Sync Service the resource is associated with. |
url
|
The absolute URL of the Sync Map resource. |
links
|
The URLs of the Sync Map's nested resources. |
revision
|
The current revision of the Sync Map, represented as a string. |
date_expires
|
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 |
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 Map's creator. If the Sync Map is created from the client SDK, the value matches the Access Token's |
Create a SyncMap resource
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 in REST API format | |
---|---|
service_sid
Path
|
The SID of the Sync Service to create the Sync Map in. |
unique_name
オプション
|
An application-defined string that uniquely identifies the resource. It can be used as an alternative to the |
ttl
オプション
|
An alias for |
collection_ttl
オプション
|
How long, in seconds, before the 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 |
例 1
例 2
例 3
Fetch a SyncMap resource
https://sync.twilio.com/v1/Services/{ServiceSid}/Maps/{Sid}
パラメーター
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Sync Service with the Sync Map resource to fetch. |
sid
Path
|
The SID of the Sync Map resource to fetch. Can be the Sync Map's |
例 1
Read multiple SyncMap resources
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 in REST API format | |
---|---|
service_sid
Path
|
The SID of the Sync Service with the Sync Map resources to read. |
例 1
Update a SyncMap resource
https://sync.twilio.com/v1/Services/{ServiceSid}/Maps/{Sid}
パラメーター
Parameters in REST API format | |
---|---|
service_sid
Path
|
The SID of the Sync Service with the Sync Map resource to update. |
sid
Path
|
The SID of the Sync Map resource to update. Can be the Sync Map's |
ttl
オプション
|
An alias for |
collection_ttl
オプション
|
How long, in seconds, before the 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 |
例 1
Delete a Sync Map resource
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 in REST API format | |
---|---|
service_sid
Path
|
The SID of the Sync Service with the Sync Map resource to delete. |
sid
Path
|
The SID of the Sync Map resource to delete. Can be the Sync Map's |
例 1
例 2
ヘルプが必要ですか?
誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。