Create a new Service resource.

POST /v1/Services

The top-level resource for a Serverless application, which serves as a container for the application environments.

Create a new Service resource.

application/x-www-form-urlencoded

Body

  • UniqueName string Required

    A user-defined string that uniquely identifies the Service resource. It can be used as an alternative to the sid in the URL path to address the Service resource. This value must be 50 characters or less in length and be unique.

  • FriendlyName string Required

    A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters.

  • IncludeCredentials boolean

    Whether to inject Account credentials into a function invocation context. The default value is true.

  • UiEditable boolean

    Whether the Service's properties and subresources can be edited via the UI. The default value is false.

Responses

  • 201 application/json

    Created

    Hide headers attributes Show headers attributes
    • Access-Control-Allow-Origin string

      Specify the origin(s) allowed to access the resource

    • Access-Control-Allow-Methods string

      Specify the HTTP methods allowed when accessing the resource

    • Access-Control-Allow-Headers string

      Specify the headers allowed when accessing the resource

    • Access-Control-Allow-Credentials boolean

      Indicates whether the browser should include credentials

    • Access-Control-Expose-Headers string

      Headers exposed to the client

    Hide response attributes Show response attributes object
    • sid string | null

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

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^ZS[0-9a-fA-F]{32}$.

    • account_sid string | null

      The SID of the Account that created the Service resource.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

    • friendly_name string | null

      The string that you assigned to describe the Service resource.

    • unique_name string | null

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

    • include_credentials boolean | null

      Whether to inject Account credentials into a function invocation context.

    • ui_editable boolean | null

      Whether the Service resource's properties and subresources can be edited via the UI.

    • domain_base string | null

      The base domain name for this Service, which is a combination of the unique name and a randomly generated string.

    • date_created string(date-time) | null

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

    • date_updated string(date-time) | null

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

    • url string(uri) | null

      The absolute URL of the Service resource.

POST /v1/Services
curl \
 --request POST 'https://serverless.twilio.com/v1/Services' \
 --user "username:password" \
 --header "Content-Type: application/x-www-form-urlencoded" \
 --data 'UniqueName=service-unique&FriendlyName=service-friendly'
Request example
{"UniqueName"=>"service-unique", "FriendlyName"=>"service-friendly"}
Response examples (201)
{
  "sid": "ZS00000000000000000000000000000000",
  "url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000",
  "links": {
    "assets": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets",
    "builds": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Builds",
    "functions": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions",
    "environments": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Environments"
  },
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "domain_base": "service-unique-1234",
  "ui_editable": false,
  "unique_name": "service-unique",
  "date_created": "2018-11-10T20:00:00Z",
  "date_updated": "2018-11-10T20:00:00Z",
  "friendly_name": "service-friendly",
  "include_credentials": true
}