Friday, May 6, 2016

#499 IaaS --> REST apis


To begin with, REST api docs are here

I suggest you go thru them first.

To perform operations on an Oracle Compute Cloud Service resource by using
REST API calls, you must specify the fully-qualified, unique URI of the resource.

Let's go back to my Compute Service -

Under Details, I find the REST Endpoint (api endpoint) - yes, I have obfuscated this somewhat!

REST request format is as follows -

https ://{ api_endpoint}/{resource_base_path}/{resource_name}

resource_name is broken down into -

So to a simple example -

Authenticate user

curl -i -X POST -H "Content-Type: application/oracle-compute-v3+json" -d '{"user":"/Compute-yourIdentityDomain/yourUser","password":"yourPwd"}' yourAPIEndpoint/authenticate/

This cookie is then used in all subsequent requests.

Set an env variable as follows to leverage the cookie.

Retrieve the names of my instances in the container

From previous posts you will remember I have NCVM1 and NCVM2

Here is the curl cmd -

curl -X GET -H "Cookie: $COMPUTE_COOKIE" -H "Accept: application/oracle-compute-v3+directory+json" https://YourRESTApiEndpoint/instance/Compute-yourIdentityDomain/yourUser/

No comments: