2

I am trying to use the Cloudcontrol REST API.

Has anybody used that API? I did not find out how to authenticate.

As an example, I tried https://api.devcctrl.com/app/APPMNAME/deployment/default/error/

I found : https://api.devcctrl.com/doc/#Token but I don't understand how exactly to use it.

An example would be great.

What I really want to do: I want to deploy an app using REST API. I cannot use the CLI tools due to missing python installation.

Thanks Mike

Hitesh
  • 3,449
  • 8
  • 39
  • 57
Mike
  • 21
  • 1

1 Answers1

2

First, in order to get the token, you need to send a HTTP POST request to api.cloudcontrol.com/token/using Basic Authentication using the email and password of your cloudControl account. You will get a JSON response like this:

{"token": "<TOKEN_KEY>"}'

You need this token key to authenticate for all other requests to the API. To do so, add an Authorization Header to your request with this content:

Authorization -> "cc_auth_token="<TOKEN_KEY>""

Furthermore, you might also need to set up some other headers for PUT or POST requests, like:

Content-Type -> "application/x-www-form-urlencoded"

Content-Length -> <length of your parametrized url values, e.g. bar=baz&foo=qux>

Accept-Encoding -> "compress, gzip"

You can find examples of this usage in the pycclib (Python) or gocclib (Go) libraries.

Fernando Á.
  • 7,295
  • 7
  • 30
  • 32