Forum Stats

  • 3,769,824 Users
  • 2,253,026 Discussions
  • 7,875,217 Comments

Discussions

GoldenGate Microservice 19c Restful API help needed.

P.Huang
P.Huang Member Posts: 51 Blue Ribbon
edited Feb 23, 2020 7:31PM in GoldenGate

Hi,

I am trying to create an extract process with Oracle GoldenGate Microservice against 19c Oracle database but got API payload is poorly formatted. I use the following reference guide:

https://docs.oracle.com/goldengate/c1230/gg-winux/OGGRA/op-services-version-extracts-extract-post.html

Return message:

{

    "$schema": "api:standardResponse",

    "links": [

        {

            "href": "http://fseast:7001/services/v2/extracts/pp",

            "mediaType": "application/json",

            "rel": "canonical"

        },

        {

            "href": "http://fseast:7001/services/v2/extracts/pp",

            "mediaType": "application/json",

            "rel": "self"

        }

    ],

    "messages": [

        {

            "$schema": "ogg:message",

            "code": "OGG-12110",

            "issued": "2020-02-17T01:20:40Z",

            "severity": "ERROR",

            "title": "JSON element '/uri/extract' value does not match the required pattern",

            "type": "http://docs.oracle.com/goldengate/c1910/gg-winux/GMESG/oggus.htm#OGG-12110"

        }

    ]

}

Attempt to open the above URL but got 404 (page not found) Is there a more recent reference manual I can refer to?

Environment: All running on Oracle Linux 7x64

DB: 19.6 CDB: boston01 with PDB name: play19

GG: 19.1.0.4 for Oracle (Microservice)

Here is my script:

[[email protected] Downloads]$ cat yy

#!/bin/bash

vPayload='{

        "config":[

            "Extract     pp",

            "ExtTrail    zz",

            "UseridAlias boston01",

            "sourcecatalog play19;",

            "table soe.warehouses;",

            "table soe.orderentry_metadata;"

        ],

        "source":{

            "tranlogs":"integrated"

        },

        "credentials":{

            "alias":"bosplay19"

        },

        "registration":{

            "containers": [ "play19" ],

            "optimized":false

        },

        "begin":"now",

        "targets":[

            {

                "name":"zz"

            }

        ],

        "status":"running"

    }'

echo $vPayload | python -mjson.tool

    curl -s -X POST \

    http://fseast:7001/services/v2/extracts/pp \

    --user "oggadmin:"oracle_4U   \

    -H 'Cache-Control: no-cache' \

    -d $vPayload | python -mjson.tool

      

[[email protected] Downloads]$

Tagged:

Answers

  • Martin Maes
    Martin Maes Member Posts: 10 Blue Ribbon
    edited Feb 20, 2020 10:59AM

    We use the following templates to create (POST) and alter (PATCH) an extract process. This works for us.

    POST:

    {

        "description": "Integrated Extract",
        "source": {
            "tranlogs": "integrated"
        },
            "credentials": {
                    "alias": "{{ gg_user_alias }}"
            },
            "registration":"default",
        "begin": "now",
        "targets": [{
            "name": "{{ gg_trail_prefix }}",
            "sizeMB": 250
        }],
        "status": "stopped"
    }

    PATCH


    {

            "credentials": {
                    "alias": "{{ gg_user_alias }}"
            },
            "config": [
                    "extract {{ gg_process_name }}",
                    "extTrail {{ gg_trail_prefix }}",
                    "useridAlias {{ gg_user_alias }}",
            ]
    }

  • P.Huang
    P.Huang Member Posts: 51 Blue Ribbon
    edited Feb 20, 2020 12:20PM

    Hi Martin,

    Thanks for your reply. However I am having problem create the extract. As far as I can tell, my payload matches the JSON specification. Do you happen to have a working JSON payload that you can share so that I know the difference between the 2?

    BTW, I am assuming the 2 payload you have are from ansiable template, and I will replace {{ xx }} with the actual value, say if you have

        "config": [
                "extract {{ gg_process_name }}",
                "extTrail {{ gg_trail_prefix }}",
                "useridAlias {{ gg_user_alias }}",
        ]

    The real payload becomes

        "config": [
                "extract ee123456",
                "extTrail ee",
                "useridAlias boston19",
        ]

    (want to make sure I am not missing brackets or quotes.....)

    What version of GolenGate Microservice do you have?

  • Martin Maes
    Martin Maes Member Posts: 10 Blue Ribbon
    edited Feb 21, 2020 3:52AM

    Hi Mr Huang

    Yes, that's correct, we're using ansible to create the extract process. Here are the 2 payloads we submit to OGG

    cat ansible.2s4lnb2fbuild/extract.post.body.json
    {
            "description": "Integrated Extract",
            "source": {
                    "tranlogs": "integrated"
            },
            "credentials": {
                    "alias": "ecdpt01"
            },
            "registration":"default",
            "begin": "now",
            "targets": [{
                    "name": "g2",
                    "sizeMB": 250
            }],
            "status": "stopped"
    }

    oraadmt04:/tmp> cat ansible.5pcj45xbbuild/extract.patch.body.json
    {
            "credentials": {
                    "alias": "ecdpt01"
            },
            "config": [
                    "extract EXDPT01",
                    "extTrail g2",
                    "useridAlias ecdpt01",
            ]
    }

    We're using the following Version of OGG:

    Version 19.1.0.0.4 OGGCORE_19.1.0.0.0_PLATFORMS_191017.1054

    Kind regards,

    Martin

  • P.Huang
    P.Huang Member Posts: 51 Blue Ribbon
    edited Feb 21, 2020 9:26AM

    Thank you Martin,

    Let me try to add an integrated extract with noncdb to see if it works.

  • P.Huang
    P.Huang Member Posts: 51 Blue Ribbon
    edited Feb 23, 2020 7:31PM

    Hi Martin,

    I am getting the same error.

    [[email protected] ~]$ cat yy

    #!/bin/bash

    vPayload='{

            "description": "Integrated Extract",

            "source": {

                    "tranlogs": "integrated"

            },

            "credentials": {

                    "alias": "ds01"

            },

            "registration":"default",

            "begin": "now",

            "targets": [{

                    "name": "g2",

                    "sizeMB": 250

            }],

            "status": "stopped"

    }'

    echo $vPayload | python -mjson.tool

    curl -s -X POST \

    http://fseast:7001/services/v2/extracts/pp \

    --user "oggadmin:"oracle_4U \

    -H 'Cache-Control: no-cache' \

    -d $vPayload | python -mjson.tool

    [[email protected] ~]$

    [[email protected] ~]$

    [[email protected] ~]$ ./yy

    {

        "begin": "now",

        "credentials": {

            "alias": "ds01"

        },

        "description": "Integrated Extract",

        "registration": "default",

        "source": {

            "tranlogs": "integrated"

        },

        "status": "stopped",

        "targets": [

            {

                "name": "g2",

                "sizeMB": 250

            }

        ]

    }  <--------------------------------------------------------------- this step confirms I have a good json document

    {

        "$schema": "api:standardResponse",

        "links": [

            {

                "href": "http://fseast:7001/services/v2/extracts/pp",

                "mediaType": "application/json",

                "rel": "canonical"

            },

            {

                "href": "http://fseast:7001/services/v2/extracts/pp",

                "mediaType": "application/json",

                "rel": "self"

            }

        ],

        "messages": [

            {

                "$schema": "ogg:message",

                "code": "OGG-12110",

                "issued": "2020-02-24T00:27:19Z",

                "severity": "ERROR",

                "title": "JSON element '/uri/extract' value does not match the required pattern",

                "type": "http://docs.oracle.com/goldengate/c1910/gg-winux/GMESG/oggus.htm#OGG-12110"

            }

        ]

    }

    [[email protected] ~]$

    Maybe I am using the wrong port?

    7000 is server manager

    7001 is admin server

    If I change the port to 7000, I got the following:

    {

        "$schema": "api:standardResponse",

        "links": [],

        "messages": [

            {

                "$schema": "ogg:message",

                "code": "OGG-12031",

                "issued": "2020-02-24T00:30:39Z",

                "severity": "ERROR",

                "title": "The requested resource does not exist.",

                "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1"

            }

        ]

    }

  • User_8E7RZ
    User_8E7RZ Member Posts: 2 Employee

    Hi.. did you get this to work. I am hitting the same issue. Can you please help me to get past the issue.