To create an extract using the Oracle GoldenGate Service API, you can use a POST request to the /services/{version}/extracts/{extract} endpoint. The API version is v2. You will need to replace {extract} with the desired name for your new extract.

An example request body is provided in the sources:

{
  "description": "Region North",
  "config": [
    "EXTRACT extn",
    "EXTTRAIL north/ea",
    "USERIDALIAS ggnorth DOMAIN OracleGoldenGate",
    "TABLE hr.*;"
  ],
  "source": "tranlogs",
  "credentials": {
    "alias": "ggnorth"
  },
  "registration": "default",
  "begin": "now",
  "targets": [
    {
      "name": "ea",
      "path": "north/",
      "sizeMB":5 
    }
  ]
}

Here is an example curl command to create an extract named EXTRACT1:

curl -i -X POST \
-H "Content-Type: application/json" \
-u <username>:<password> \
-d '{
  "description": "Example Extract",
  "config": [
    "EXTRACT EXTRACT1",
    "EXTTRAIL north/ea",
    "USERIDALIAS ggnorth DOMAIN OracleGoldenGate",
    "TABLE hr.*;"
  ],
  "source": "tranlogs",
  "credentials": {
    "alias": "ggnorth"
  },
  "registration": "default",
  "begin": "now",
  "targets": [
    {
      "name": "ea",
      "path": "north/",
      "sizeMB":5 
    }
  ]
}' \
http://<hostname>:<port>/services/v2/extracts/EXTRACT1

Explanation of the command:

  • curl -i -X POST: This initiates a POST request with curl. The -i option includes the HTTP headers in the output.
  • -H “Content-Type: application/json”: This sets the Content-Type header to indicate that the request body is in JSON format.
  • -u :: Replace with your Oracle GoldenGate Service credentials.
  • -d ‘{ … }’: This provides the JSON request body. You will need to adjust the content of this JSON object according to your specific extract configuration requirements. The example above shows a basic configuration.
  • http://:/services/v2/extracts/EXTRACT1: Replace with the actual hostname and port of your Oracle GoldenGate Service. EXTRACT1 is the name of the extract being created.

A successful request will typically return a 201 Created status code.

Quote of the week

“Control what I can control”

~ Alex Lima

Designed with WordPress