Creating a new OC application


#1

Request

curl -X POST
     -H "Authorization: Bearer <thy_api_key>" \
     -d '<request_body_json>'
https://www.opscaptain.com/api/instances/new

Request body JSON format

{
     "name": "STRING", 
     "region": "STRING", 
     "tier": "STRING", 
     "dbengine": "optional STRING", 
     "image": "optional STRING"
}

Request body parameters explained

name – The name of the application you want to create. If you have previously created an application with a name equal to the provided value, the request will fail.

region – The region where this application is to deployed. Possible regions from which you can select include:

  • us-east
  • eu-west

tier – The plan which also determines the container memory and cpu limitations of this application. You can review the pricing page for more information. Possible values include:

  • gp-xs
  • gp-s
  • gp-m
  • gp-l1
  • gp-l2
  • gp-l4

dbengine – OC intends to provide shared database instances which applications can use. This shared database instance will be managed by us and will provide simple backup and restore operations. Currently this feature is only available for the MongoDB database. If your application requires a MongoDB database, you can specify this parameter. Possible values include:

  • mongodb

image – Because the shared database is only available for MongoDB at the moment, some applications may wish to run other databases such as MySQL and PostgreSQL. If that is the case, you can mount the docker image of the corresponding database to this application. We do not allow for running arbitrary images at the moment. Possible values include:

Remarks

This endpoint returns an id value which can be used to poll for the completion of this task. Note, you must wait for this operation to complete before you can proceed to deploy code to the application. See example response:

{
     "ok": 1, 
     "id": "STRING", 
}

Now to check if this create task has completed successfully, you can call the below endpoint and check if the status attribute in the response JSON has the value Completed

curl -X GET
     -H "Authorization: Bearer <thy_api_key>" \
https://www.opscaptain.com/api/octasks/status?id=<insert_id_here>

The above request will respond with either one of the values Completed, In progress or Failed. See below:

{
     "status": "STRING", 
     "task": "STRING", 
     "logs": "STRING"
}