Using CURL with the API

In many cases, it is helpful to test the API using CURL commands.

Here is the basic structure of a curl command using an auth token

./drpcli users token [username]
    export TOKEN=[token]
    curl -H "Authorization: Bearer $TOKEN" --insecure https//[endpoint url]/api/v3/info

You can also use user security

curl --user rocketskates:r0cketsk8ts --insecure https//[endpoint url]/api/v3/info

Uploading ISO, File or Plugin Providers

For binary items, Digital Rebar Provision expects either and “application/octet-stream” or “multipart/form-data” for the POST. Octet is helpful for direct sending from programs like the CLI. Multipart is helpful when sending files from a webapp where the browser is directly responsible for handling file uploads.

    ./drpcli users token [username]
    export TOKEN=[token]
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: multipart/form-data" -F "file=@[filepath]/[filename]" --insecure https://[endpoint url]/api/v3/isos/[filename]