Search code examples
apicontainersibm-cloud

Is there a sample code for using IBM Bluemix Container API?


I'm trying to create container in bluemix with API as it in http://ccsapi-doc.mybluemix.net In the document it mentions:

When using the API with the new model, the following HTTP headers shall be provided: X-Auth-Token = Bluemix JWT Token X-Auth-Project-Id = Space GUID

But I have no idea how to get or generate the Bluemix JWT Token. Can someone help me ?


Solution

  • You can get X-Auth-Token by cf oauth-token command. Then copy and paste rest of the part after bearer. And you also can get X-Auth-Project-Id by cf space --guid <space Name>. Please see below commands;

    $ cf login -a api.<region>.bluemix.net -u <space name> -o <org name> -s <space name>
    
    $ cf ic login
    
    $ cf oauth-token
    
    $ cf space <space-name> --guid (space name where the container exists)