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

メニュー

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?

Sync REST: Documents

A document is a simple object with these characteristics:

  • Single JSON object up to 16KB in size
  • Modification history is not maintained, but documents are assigned a new revision after each modification.
  • Concurrency control is supported via eventual model, using revision for conditional updates.
  • Expires and gets deleted automatically, if eviction is configured via TTL parameter. By default, data is persisted permanently.

プロパティ

Each Document resource has the following properties. Unique name and expiration date attributes are optional and allowed to be null.

Names in PHP format
sid
sid<ET> Not PII

The unique string that we created to identify the Document resource.

uniqueName
文字列 PII MTL: 30 DAYS

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 and can be up to 320 characters long.

accountSid
sid<AC> Not PII

The SID of the Account that created the Document resource.

serviceSid
sid<IS> Not PII

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

url
url Not PII

The absolute URL of the Document resource.

links
uri_map Not PII

The URLs of resources related to the Sync Document.

revision
文字列 Not PII

The current revision of the Sync Document, represented as a string. The revision property is used with conditional updates to ensure data consistency.

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

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

dateExpires
date_time<iso8601> Not PII

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

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

{
  "account_sid": "ACxx",
  "service_sid": "ISxx",
  "sid": "ETxx",
  "unique_name": "MyDocument",
  "revision": 0,
  "date_created": "2015-11-24T22:18:57Z",
  "date_updated": "2015-11-24T22:18:57Z",
  "date_expires": null,
  "created_by": "system",
  "url": "https://sync.twilio.com/v1/Services/ISxx/Documents/ETxx",
  "links": {
    "permissions": "https://sync.twilio.com/v1/Services/ISxx/Documents/ETxx/Permissions"
  },
  "data": {
      <user-defined Document content>
  }
}

アクション


List All Documents

GET /v1/Services/ISxx/Documents

Retrieve a list of all Documents belonging to this Service Instance, along with their data.

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

        
        
        
        

        Create a Document

        POST /v1/Services/ISxx/Documents
        

        Create a new Document in this Service Instance, optionally giving it a unique name, assigning initial data and expiration deadline.

        パラメーター

        Names in PHP format
        serviceSid
        必須
        post sid_like<IS> Not PII

        The SID of the Sync Service to create the new Document resource in.

        uniqueName
        オプション
        post 文字列 PII MTL: 30 DAYS

        An application-defined string that uniquely identifies the Sync Document

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

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

        ttl
        オプション
        post integer Not PII

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

              
              
              
              

              Retrieve a Document

              GET /v1/Services/ISxx/Documents/ETxx|UniqueName
              

              Fetch data of a specific Document by its SID or unique name.

                    
                    
                    
                    

                    Update a Document

                    POST /v1/Services/ISxx/Documents/ETxx|UniqueName
                    

                    Update the Document data or expiration deadline, addressed its SID or unique name.

                    パラメーター

                    Names in PHP format
                    serviceSid
                    必須
                    post sid_like<IS> Not PII

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

                    sid
                    必須
                    post sid_like<ET> Not PII

                    The SID of the Document resource to update.

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

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

                    ttl
                    オプション
                    post integer Not PII

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

                          
                          
                          
                          

                          Delete a Document

                          DELETE /v1/Services/ISxx/Documents/ETxx|UniqueName
                          

                          Permanently delete a specific Document from current Service Instance, addressed by SID or unique name.

                                
                                
                                
                                
                                Rate this page:

                                ヘルプが必要ですか?

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