To create database credentials using the Oracle GoldenGate Service API, you can use a POST request to the /services/{version}/credentials/{domain}/{alias} endpoint. According to the documentation, the API version is v2. You will need to replace {domain} with the desired credential store domain (the default is OracleGoldenGate) and {alias} with the name you want to give to these credentials. This operation requires the Administrator role.
The request body should be a JSON object that conforms to the #/definitions/ogg:credentials schema. This schema includes the userid and password for the database.
Here is an example curl command to create database credentials with the alias mydbuser in the default OracleGoldenGate domain:
curl -i -X POST \
-H "Content-Type: application/json" \
-u <username>:<password> \
-d '{
"userid": "your_database_user",
"password": "your_database_password"
}' \
http://<hostname>:<port>/services/v2/credentials/OracleGoldenGate/mydbuser
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 and with your Oracle GoldenGate Service credentials, which must have the Administrator role.
- -d ‘{ … }’: This provides the JSON request body containing the userid and password for your database credentials. Replace “your_database_user” and “your_database_password” with the actual credentials.
- http://<hostname>:<port>/services/v2/credentials/OracleGoldenGate/mydbuser: Replace with the actual hostname and port of your Oracle GoldenGate Service. OracleGoldenGate is the domain, and mydbuser is the alias for the credentials being created.
A successful request will typically return a 201 Created status code. You might also see a message in the response indicating that the credential store has been altered.
https://docs.oracle.com/en/middleware/goldengate/core/23/oggra