メニュー

Expand
ページを評価:

Variable

Variables are key/value pairs that you can add to a specific Environment. Use these for storing configuration like API keys rather than hardcoding them into your Functions. Environment Variables are encrypted, so they are the preferred way to store API keys, passwords, and any other secrets that your Function needs to use.

Variable properties

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

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

account_sid
sid<AC> Not PII

The SID of the Account that created the Variable resource.

service_sid
sid<ZS> Not PII

The SID of the Service that the Variable resource is associated with.

environment_sid
sid<ZE> Not PII

The SID of the Environment in which the Variable exists.

key
文字列 PII MTL: 7 DAYS

A string by which the Variable resource can be referenced.

value
文字列 PII MTL: 7 DAYS

A string that contains the actual value of the Variable.

date_created
date_time<iso8601> Not PII

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

date_updated
date_time<iso8601> Not PII

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

url
url Not PII

The absolute URL of the Variable resource.

Create a Variable resource

post
https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables
パラメーター
Parameters in REST API format
service_sid
Path
post sid_like<ZS> Not PII

The SID of the Service to create the Variable resource under.

environment_sid
Path
post sid<ZE> Not PII

The SID of the Environment in which the Variable resource exists.

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

A string by which the Variable resource can be referenced. It can be a maximum of 128 characters.

value
必須
post 文字列 PII MTL: 7 DAYS

A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size.

例 1
        
        
        

        Fetch a Variable resource

        GET
        https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}
        パラメーター
        Parameters in REST API format
        service_sid
        Path
        GET sid_like<ZS> Not PII

        The SID of the Service to fetch the Variable resource from.

        environment_sid
        Path
        GET sid<ZE> Not PII

        The SID of the Environment with the Variable resource to fetch.

        sid
        Path
        GET sid<ZV> Not PII

        The SID of the Variable resource to fetch.

        例 1
              
              
              

              Read multiple Variable resources

              GET
              https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables
              パラメーター
              Parameters in REST API format
              service_sid
              Path
              GET sid_like<ZS> Not PII

              The SID of the Service to read the Variable resources from.

              environment_sid
              Path
              GET sid<ZE> Not PII

              The SID of the Environment with the Variable resources to read.

              例 1
                    
                    
                    

                    Update a Variable resource

                    post
                    https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}
                    パラメーター
                    Parameters in REST API format
                    service_sid
                    Path
                    post sid_like<ZS> Not PII

                    The SID of the Service to update the Variable resource under.

                    environment_sid
                    Path
                    post sid<ZE> Not PII

                    The SID of the Environment with the Variable resource to update.

                    sid
                    Path
                    post sid<ZV> Not PII

                    The SID of the Variable resource to update.

                    key
                    オプション
                    post 文字列 PII MTL: 7 DAYS

                    A string by which the Variable resource can be referenced. It can be a maximum of 128 characters.

                    value
                    オプション
                    post 文字列 PII MTL: 7 DAYS

                    A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size.

                    例 1
                          
                          
                          

                          Delete a Variable resource

                          削除する
                          https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}
                          パラメーター
                          Parameters in REST API format
                          service_sid
                          Path
                          削除する sid_like<ZS> Not PII

                          The SID of the Service to delete the Variable resource from.

                          environment_sid
                          Path
                          削除する sid<ZE> Not PII

                          The SID of the Environment with the Variables to delete.

                          sid
                          Path
                          削除する sid<ZV> Not PII

                          The SID of the Variable resource to delete.

                          例 1
                                
                                
                                
                                ページを評価:

                                ヘルプが必要ですか?

                                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 Community Forums or browsing the Twilio tag on Stack Overflow.

                                      
                                      
                                      

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

                                      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