IBM Cloud Docs
Using cURL

Using cURL

You can get the most out working with the command-line in most environments with IBM® Storage Ceph® as a Service and cURL.

Here's a 'cheat sheet' of basic curl commands for the IBM® Storage Ceph® as a Service REST API.

Using curl assumes a certain amount of familiarity with the command-line and Object Storage, and have the necessary information from a credential, the endpoints reference, or the console. If any terms or variables are unfamiliar, they can be found in the glossary.

Note: Personally Identifiable Information (PII): When naming buckets or objects, do not use any information that can identify any user (natural person) by name, location, or any other means.

Request an IAM Token

Two ways you can generate an IAM oauth token for authenticating requests are using a curl command with an API key (described later), or from the command-line by using IBM Cloud® CLI.

Request an IAM token by using an API key

Ensure that you have an API key. You can get one from IBM Cloud® Identity and Access Management.

curl -X "POST" "https://iam.cloud.ibm.com/oidc/token" \
     -H 'Accept: application/json' \
     -H 'Content-Type: application/x-www-form-urlencoded' \
     --data-urlencode "apikey={api-key}" \
     --data-urlencode "response_type=cloud_iam" \
     --data-urlencode "grant_type=urn:ibm:params:oauth:grant-type:apikey"

Get your resource instance ID

Some of the following commands require an ibm-service-instance-id parameter. To find this value, go to the Credentials tab of your Object Storage instance in the cloud console. Create a credential if needed, then use the View credentials menu to see the JSON format. Use the value of resource_instance_id.

For use with curl APIs, you need only the UUID that starts after the last single colon and ends before the final double colon. For example, the ID crn:v1:bluemix:public:software-defined-storage:global:a/81caa0254631ce5f9330ae427618f209:39d8d161-22c4-4b77-a856-f11db5130d7d:: can be abbreviated to 39d8d161-22c4-4b77-a856-f11db5130d7d.

Next Steps

The detailed description of the RESTful API for IBM Storage Ceph as a Service can be found in the IBM CephaaS Object Storage API Documentation.