cnvrg APIs can help you run cnvrg capabilities directly without using cnvrg-cli.
cnvrg API format looks as follows:

{REQUEST_METHOD] [API]
{AUTH_TOKEN HEADER}
{JSON DATA}

REQUEST_METHOD: one of the following GET/POST/DELETE
API: The api method you wish to send, i.e. https:/cnvrg.io/api/v1/users/cnvrg/projects/example_project/experiments/list
AUTH_TOKEN HEADER: The token to verify the user's identity.
All APIs requests should be sent with an HTTP HEADER that includes a valid token. The token will be used to verify the user's identity against cnvrg servers. If a token is missing or invalid the user will  receive the following error:
{"status":401,"message":"Not Authorize, Are you logged in?"}
JSON DATA: JSON post data

Responses:
If the request was successful the response will be as follows:
{"status":200,"result":{...}}
If the request wasn't successful the response will be as follows:
{"status":400/401/500,"message":""}

AUTH_TOKEN:
To receive AUTH_TOKEN the user will send a sign_in request:
POST https://cnvrg.io/api/v1/users/sign_in
HTTP Headers:
EMAIL: user@gmail.com
PASSWORD: mysecretpassword

Response:
{"status":200,"result":{"token":"WEzCzMjdh6Ajj7yLj2hD","username":"myusername"}}
The token in the response can be used for all API requests. 

List of all available API methods can be find here

Examples:

Example #1: Get a list of all experiments in a project:

Request:
GET https:/cnvrg.io/api/v1/users/cnvrg/projects/example_project/experiments/list
Request Headers:
Connection: keep-alive
AUTH_TOKEN: WEzCzMjdh6Ajj7yLj2hD
Response:
{"status":200,"result":{"size":5,"experiments":[{"id":"jvhBymwsBBz_ovRgUvZx","status":"Success"},{"id":"bibL7PBFFYvmfkSsTySV","status":"Success"},{"id":"s8nwR69K4wYkHTLxkPZW","status":"Running"},{"id":"WwigebwZGRCkV-BPZxbm","status":"Success"},{"id":"QY7Y4126Jsq-QGQPT6Y7","status":"Success"}]}}

Example #2: Run an experiment
POST
https://cnvrg.io/users/cnvrg/projects/example_projects/experiments/run
Request Headers:
Connection: keep-alive
AUTH_TOKEN: WEzCzMjdh6Ajj7yLj2hD
Request Data:
{"command":"python experiment.py", "commit_sha1":"", "instance_type":"small", "scheduling_query":"", "grid":"", "dataset_slug":"data_sample", "dataset_commit":""}

Response:
{"status":200,"result":{"exp_url":"KtvDuZzE72xH5nBAV1uz"}}


 



Did this answer your question?