GoldenGate Add Credentialstore with REST API (Part 1- REST API Series)

In this next series of REST API for GoldenGate Microservices, I will demonstrate how we can perform most general activities, that we can execute from the front end but with backend Rest APIs.

In this post i am demonstrating how to add a credentialstore entry. I will be using the current latest version 21.3 from OCI Marketplace

First let’s check the existing entries:

Next, let’s check the same with REST API:

curl -u oggadmin:”xxxxx” \
-H “Content-Type: application/json” \
-H “Accept: application/json” \
-H ‘cache-control: no-cache’ \
-X GET http://localhost:9011/services/v2/connections | json_reformat

-bash-4.2$ curl -u oggadmin:"xxxxx" \
> -H "Content-Type: application/json" \
> -H "Accept: application/json" \
> -H 'cache-control: no-cache' \
> -X GET http://localhost:9011/services/v2/connections | json_reformat
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1723  100  1723    0     0  21485      0 --:--:-- --:--:-- --:--:-- 21810
{
    "$schema": "api:standardResponse",
    "links": [
        {
            "rel": "canonical",
            "href": "http://localhost:9011/services/v2/connections",
            "mediaType": "application/json"
        },
        {
            "rel": "self",
            "href": "http://localhost:9011/services/v2/connections",
            "mediaType": "application/json"
        },
        {
            "rel": "describedby",
            "href": "http://localhost:9011/services/v2/metadata-catalog/connections",
            "mediaType": "application/schema+json"
        }
    ],
    "messages": [

    ],
    "response": {
        "$schema": "ogg:collection",
        "items": [
            {
                "links": [
                    {
                        "rel": "parent",
                        "href": "http://localhost:9011/services/v2/connections",
                        "mediaType": "application/json"
                    },
                    {
                        "rel": "canonical",
                        "href": "http://localhost:9011/services/v2/connections/OracleGoldenGate.OGG_SRC_PDB",
                        "mediaType": "application/json"
                    }
                ],
                "$schema": "ogg:collectionItem",
                "name": "OracleGoldenGate.OGG_SRC_PDB"
            },
            {
                "links": [
                    {
                        "rel": "parent",
                        "href": "http://localhost:9011/services/v2/connections",
                        "mediaType": "application/json"
                    },
                    {
                        "rel": "canonical",
                        "href": "http://localhost:9011/services/v2/connections/OracleGoldenGate.OGG_SRC_CDB",
                        "mediaType": "application/json"
                    }
                ],
                "$schema": "ogg:collectionItem",
                "name": "OracleGoldenGate.OGG_SRC_CDB"
            },
            {
                "links": [
                    {
                        "rel": "parent",
                        "href": "http://localhost:9011/services/v2/connections",
                        "mediaType": "application/json"
                    },
                    {
                        "rel": "canonical",
                        "href": "http://localhost:9011/services/v2/connections/OracleGoldenGate.OGG_TRG_CDB",
                        "mediaType": "application/json"
                    }
                ],
                "$schema": "ogg:collectionItem",
                "name": "OracleGoldenGate.OGG_TRG_CDB"
            },
            {
                "links": [
                    {
                        "rel": "parent",
                        "href": "http://localhost:9011/services/v2/connections",
                        "mediaType": "application/json"
                    },
                    {
                        "rel": "canonical",
                        "href": "http://localhost:9011/services/v2/connections/OracleGoldenGate.OGG_TRG_PDB",
                        "mediaType": "application/json"
                    }
                ],
                "$schema": "ogg:collectionItem",
                "name": "OracleGoldenGate.OGG_TRG_PDB"
            }
        ]
    }
}
-bash-4.2$

Next we will alter and add the new entry, please note that I will be using EZConnect instead of TNS Names entry. I find it best practices, specially for HA scenarios.

curl -u oggadmin:”xxxxx” \
-H “Content-Type: application/json” \
-H “Accept: application/json” \
-X POST http://localhost:9011/services/v2/credentials/OracleGoldenGate/ATEAM_REST_TEST \
-d ‘{“userid”:”c##ggadmin@oggtrg.subnet.vcn.oraclevcn.com:1521/trgpdb.subnet.vcn.oraclevcn.com”, “password”:”xxxxx”}’ | json_reformat

-bash-4.2$ curl -u oggadmin:"xxxxx" \
> -H "Content-Type: application/json" \
> -H "Accept: application/json" \
> -X POST http://localhost:9011/services/v2/credentials/OracleGoldenGate/ATEAM_REST_TEST \
> -d '{"userid":"c##ggadmin@oggtrg.subnet.vcn.oraclevcn.com:1521/trgpdb.subnet.vcn.oraclevcn.com", "password":"xxxxx"}' \
> | json_reformat
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   666  100   545  100   121   4646   1031 --:--:-- --:--:-- --:--:--  4698
{
    "$schema": "api:standardResponse",
    "links": [
        {
            "rel": "canonical",
            "href": "http://localhost:9011/services/v2/credentials/OracleGoldenGate/ATEAM_REST_TEST",
            "mediaType": "application/json"
        },
        {
            "rel": "self",
            "href": "http://localhost:9011/services/v2/credentials/OracleGoldenGate/ATEAM_REST_TEST",
            "mediaType": "application/json"
        }
    ],
    "messages": [
        {
            "$schema": "ogg:message",
            "title": "Credential store altered.",
            "code": "OGG-15114",
            "severity": "INFO",
            "issued": "2021-10-01T21:51:27Z",
            "type": "http://docs.oracle.com/goldengate/c2130/gg-winux/GMESG/oggus.htm#OGG-15114"
        }
    ]
}
-bash-4.2$

Next let’s check in the front end:

We can also check from the back end:

-bash-4.2$ curl -u oggadmin:"xxxxx" \
> -H "Content-Type: application/json" \
> -H "Accept: application/json" \
> -H 'cache-control: no-cache' \
> -X GET http://localhost:9011/services/v2/connections | json_reformat
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2050  100  2050    0     0  23048      0 --:--:-- --:--:-- --:--:-- 23295
{
    "$schema": "api:standardResponse",
    "links": [
        {
            "rel": "canonical",
            "href": "http://localhost:9011/services/v2/connections",
            "mediaType": "application/json"
        },
        {
            "rel": "self",
            "href": "http://localhost:9011/services/v2/connections",
            "mediaType": "application/json"
        },
        {
            "rel": "describedby",
            "href": "http://localhost:9011/services/v2/metadata-catalog/connections",
            "mediaType": "application/schema+json"
        }
    ],
    "messages": [

    ],
    "response": {
        "$schema": "ogg:collection",
        "items": [
            {
                "links": [
                    {
                        "rel": "parent",
                        "href": "http://localhost:9011/services/v2/connections",
                        "mediaType": "application/json"
                    },
                    {
                        "rel": "canonical",
                        "href": "http://localhost:9011/services/v2/connections/OracleGoldenGate.OGG_TRG_PDB",
                        "mediaType": "application/json"
                    }
                ],
                "$schema": "ogg:collectionItem",
                "name": "OracleGoldenGate.OGG_TRG_PDB"
            },
            {
                "links": [
                    {
                        "rel": "parent",
                        "href": "http://localhost:9011/services/v2/connections",
                        "mediaType": "application/json"
                    },
                    {
                        "rel": "canonical",
                        "href": "http://localhost:9011/services/v2/connections/OracleGoldenGate.OGG_TRG_CDB",
                        "mediaType": "application/json"
                    }
                ],
                "$schema": "ogg:collectionItem",
                "name": "OracleGoldenGate.OGG_TRG_CDB"
            },
            {
                "links": [
                    {
                        "rel": "parent",
                        "href": "http://localhost:9011/services/v2/connections",
                        "mediaType": "application/json"
                    },
                    {
                        "rel": "canonical",
                        "href": "http://localhost:9011/services/v2/connections/OracleGoldenGate.OGG_SRC_CDB",
                        "mediaType": "application/json"
                    }
                ],
                "$schema": "ogg:collectionItem",
                "name": "OracleGoldenGate.OGG_SRC_CDB"
            },
            {
                "links": [
                    {
                        "rel": "parent",
                        "href": "http://localhost:9011/services/v2/connections",
                        "mediaType": "application/json"
                    },
                    {
                        "rel": "canonical",
                        "href": "http://localhost:9011/services/v2/connections/OracleGoldenGate.OGG_SRC_PDB",
                        "mediaType": "application/json"
                    }
                ],
                "$schema": "ogg:collectionItem",
                "name": "OracleGoldenGate.OGG_SRC_PDB"
            },
            {
                "links": [
                    {
                        "rel": "parent",
                        "href": "http://localhost:9011/services/v2/connections",
                        "mediaType": "application/json"
                    },
                    {
                        "rel": "canonical",
                        "href": "http://localhost:9011/services/v2/connections/OracleGoldenGate.ATEAM_REST_TEST",
                        "mediaType": "application/json"
                    }
                ],
                "$schema": "ogg:collectionItem",
                "name": "OracleGoldenGate.ATEAM_REST_TEST"
            }
        ]
    }
}
-bash-4.2$

Next Add Schematrandata: https://oraclespin.com/2021/10/04/goldengate-add-schematrandata-rest-api-series/