cdpcurl example

After you install cdpcurl and generate the API access key, you are ready to make an API call.

If you have not created a profile in $HOME/.cdp/credentials that contains the API access key ID and private key pair, make sure that you have the API access key ID and private key that you generated.
The example below walks you through the steps required to make an API call that lists all environments in the CDP Control Plane.
  1. In the CDP Control Plane Public API Documentation, find the endpoint for the list environments request and form the correct URI.
    The correct URI is an HTTPS URL that contains the hostname for the desired service and the path to the desired endpoint. In this "list environments" example, the correct URI would be:
  2. Form the cdpcurl command.

    The CDP API uses the HTTPS protocol to make API calls, and most CDP API calls are POST requests, so be sure to use the [-X REQUEST] and [-d DATA] arguments in the command. For more details, refer to the awscurl documentation and the topic Making API calls with cdpcurl. The --profile argument below points to the profile you likely created in $HOME/.cdp/credentials, that contains the API access key and private key pair. If you did not create this profile, you will have to pass the --access-key and --private-key arguments as well.

    In this example, the command would be:

    $ cdpcurl --profile sandbox -X POST -d '{}'
  3. Run this command in a terminal window to make the API call, and then receive the response. If the call is successful, the response is the EnvironmentSummary array.