Create a Service

post

/api/v2/services/

To create a new service, you pass the properties of the new service in the body of the request.

Request

Supported Media Types
Body ()
Body parameters
Root Schema : schema
Type: object
Show Source
Nested Schema : editorTemp
Type: object
Show Source
Nested Schema : struct
Type: object
Show Source
Nested Schema : container_name
Type: object
Show Source
Nested Schema : cpuset
Type: object
Show Source
Nested Schema : dns
Type: object
Show Source
Nested Schema : dns_search
Type: object
Show Source
Nested Schema : domainname
Type: object
Show Source
Nested Schema : environment
Type: object
Show Source
Nested Schema : hostname
Type: object
Show Source
Nested Schema : labels
Type: object
Show Source
Nested Schema : log_driver
Type: object
Show Source
Nested Schema : log_opt
Type: object
Show Source
Nested Schema : mac_address
Type: object
Show Source
Nested Schema : mem_limit
Type: object
Show Source
Nested Schema : memswap_limit
Type: object
Show Source
Nested Schema : net
Type: object
Show Source
Nested Schema : pid
Type: object
Show Source
Nested Schema : ports
Type: object
Show Source
Nested Schema : privileged
Type: object
Show Source
Nested Schema : restart
Type: object
Show Source
Nested Schema : tty
Type: object
Show Source
Nested Schema : user
Type: object
Show Source
Nested Schema : volumes
Type: object
Show Source
Nested Schema : dns
Type: array
Show Source
Nested Schema : dns_search
Type: array
Show Source
Nested Schema : environment
Type: array
Show Source
Nested Schema : labels
Type: array
Show Source
Nested Schema : log_opt
Type: array
Show Source
Nested Schema : ports
Type: array
Show Source
Nested Schema : volumes
Type: array
Show Source
Nested Schema : items
Type: object
Show Source
Nested Schema : items
Type: object
Show Source
Nested Schema : items
Type: object
Show Source
Nested Schema : items
Type: object
Show Source
Nested Schema : items
Type: object
Show Source
Nested Schema : items
Type: object
Show Source
Nested Schema : items
Type: object
Show Source
Security
Back to Top

Response

Supported Media Types

200 Response

200 Response
Body ()
Root Schema : schema
Type: array
Show Source
Nested Schema : items
Type: object
Show Source
Nested Schema : service
Type: object
Show Source

Default Response

Error Payload
Body ()
Root Schema : schema
Type: array
Show Source
Back to Top

Examples

The following example shows how to create an existing Oracle Container Cloud Service deployment by submitting a POST request on the REST resource using cURL. For more information about cURL, see Use cURL

Note: The command in this example uses the URL structure https://rest_server_url/resource-path, where rest_server_url is the manager node for the Oracle Cloud Container instance. See Send Requests for the appropriate URL structure to use for Oracle Public Cloud.

cURL Command

curl -ski 
     -X "POST" 
     -H "Authorization: Bearer 53e024fb32c05723" "https://rest_server_url/api/v2/services/"
     --data "@newservice.json"

Contents of the newservice.json file

The following example shows how to provide the properties of a new service in a JSON file. You can then pass this JSON file to the endpoint, using a cURL command.

Note when providing the JSON code within the content parameter, you must use escape characters (\) to identify line breaks (<tt>/n</tt>), quotation marks (???), and backslash (\) characters.

{
"content": "version: 2\nservices:\n myservice_name:\n image: \"myimage_name\"\n environment:\n - myenvironment_variable1\n - \"myenvironment_variable2\"\n - \"occs:availability=per-pool\"\n"
}
Back to Top