Use cURL
cURL is an open source, command-line tool for transferring data with URL syntax, supporting various protocols including HTTP and HTTPS.
The examples within this document use the cURL command-line tool to demonstrate how to access the Oracle Data Integration Platform Cloud Service REST API.
To access the REST APIs, authorization headers need to be sent. To obtain the header:
- From the Identity Cloud Service console, obtain the Client ID, Client Secret, and the scope URL for the Agent application added as a confidential application. See Add DIPC Agent as a Confidential Application for DIPC Classic.
- Get a Base64 encoded string of
ClientID
: Client Secret. For example,echo "X:Y" | base64
, where X = ClientID of Agent app, Y = Client Secret of Agent app. - Get the Auth token:
curl -X POST https://<identity-cloud-service-site>/oauth2/v1/token -H 'authorization: Basic <Base64 output from step 2>' -H 'content-type: application/x-www-form-urlencoded;charset=UTF-8' -d 'grant_type=client_credentials&scope=<Scope url obtained in step1>'
. - Invoke cURL and specify one or more of the command-line options defined in the following table, as required, to direct its execution. For example,
curl -v -X GET <Rest end-point> -H "Authorization: Bearer <token obtained in step 3>
.
cURL Option | Description |
---|---|
-d, --data @file.json |
Identifies the file that contains the request body, in JSON format, on the local machine. Alternatively, you can pass the request body with -d"{id=5,status='OK'} . |
-F, --form @file.json |
Identifies form data, in JSON format, on the local machine. |
-H --header, -I -include, and -X --request <method> |
Defines one or both of the following:
|
-i |
Displays response header information. |
-u, --user <username>:<password> |
Specifies the user name and password for the <ProductName> account. |
-X |
Indicates the type of request (for example, GET, POST). |
For example:
curl -i -X GET -u <username>:<password> -H <request-header>:<value> https://<subdomain>.<domain>.com/<path>/<resource-path>