Test Data Manager

Expand all | Collapse all

Using REST POST method to POST a job in TDOD

  • 1.  Using REST POST method to POST a job in TDOD

    Posted 09-07-2018 11:16 AM

    I am looking to invoke my TDOD portal tile/form using REST  POST service .

    The form is a group job which has sub processes under it.

    I am using below request but the POST method is failing at parsing.

    Can someone suggest what am I missing here.

     

    {"name":"TEST_REST","description":"TEST AO REST","projectId":4191,"versionId":4192,"type":"GROUPJOB","origin":"flow_origin","scheduledTime":1536244043976,"jobs":[{"batchEngineThread":"ANY","description":"","jobTitle":"Group Job","levelID":4223,"publishVariables":[{"name":"OBS_ENV","value":"IT2"},{"name":"BANK","value":"4451"},{"name":"PRD_CD","value":"DDA"}],"seq":1,"vtfnodeID":"420","vtfnodeName":"CIX","iterations":1,"defaultPublishID":},{"batchEngineThread":"ANY","dataSourceProfile":"","dataTargetProfile":"","description":"","jobTitle":"Group Job","levelID":4231,"publishVariables":[{"name":"OBS_ENV","value":"IT2"},{"name":"PRD_CD","value":"DDA"}],"seq":2,"vtfnodeID":"430","vtfnodeName":"OBP","iterations":1,"defaultPublishID":},{"batchEngineThread":"ANY","dataSourceProfile":"","dataTargetProfile":"","description":"","jobTitle":"Group Job","levelID":4232,"publishVariables":[{"name":"REC_COUNT","value":"10"},{"name":"OBS_ENV","preResolveError":"","preResolveValue":"","value":"IT2"}],"seq":3,"vtfnodeID":"440","vtfnodeName":"ENROLL USERS","iterations":1,"defaultPublishID":27496},{"batchEngineThread":"ANY","dataSourceProfile":"","dataTargetProfile":"","description":"","jobTitle":"Group Job","levelID":4236,"publishVariables":[{"name":"OBS_ENV","value":"IT2"}],"seq":4,"vtfnodeID":"450","vtfnodeName":"GET SSN","iterations":1,"defaultPublishID":},
    {"batchEngineThread":"ANY","dataSourceProfile":"","dataTargetProfile":"","description":"","jobTitle":"GroupJob","levelID":4237,"publishVariables":[{"name":"REC_COUNT","value":"10"},{"name":"OBS_ENV","preResolveError":"","preResolveValue":"","value":"IT2"}],"seq":5,"vtfnodeID":"460","vtfnodeName":"OUTPUT","iterations":1,"defaultPublishID":}]}



  • 2.  Re: Using REST POST method to POST a job in TDOD

    Posted 09-07-2018 01:57 PM

    Your JSON doesn't parse correctly.  Run it through jsonlint.com and you'll see where the problems are... I would assume that this is what is causing the parse failures...

     

    But basically all '"defaultPublishID":' items are failing to validate. You have defined the element here, but no value assigned to it.

     

    We have similar examples defined here:

    Using the TDM API to call a Specific Flow - CA Knowledge 

     

    I would think that this element should have a value associated with it. Perhaps 'null' or '0' (less the '').



  • 3.  Re: Using REST POST method to POST a job in TDOD

    Posted 09-10-2018 09:38 PM

    Thanks Sean.

    I followed the example mentioned in the post you provided but I am getting 500 response on posting the request. 

    The response message says - Invalid input parameters : project id is required

     

    But there is project id tag in the request that I am using. Below is the request that I have used(i have removed values for most of tags here). Could someone suggest what am I missing here.

    {
    "jobPubParams":{
    "almjobs":[],
    "rallyJobs":[],
    "jobParams":[],
    "publishJobs":[
    { "batchEngineThread":"ANY",
    "dataSourceProfile":"",
    "dataTargetProfile":"",
    "description":"",
    "jobTitle":"Group Job",
    "levelID":4223,
    "publishVariables":
    [
    {"name":"OBS_ENV","preResolveError":"","preResolveValue":"","value":""},
    {"name":"BANK","preResolveError":"","preResolveValue":"","value":""},
    {"name":"PRD_CD","preResolveError":"","preResolveValue":"","value":""}
    ],
    "seq":1,
    "vtfnodeID":"",
    "vtfnodeName":"",
    "iterations":1,
    "defaultPublishID":
    },
    { "batchEngineThread":"ANY",
    "dataSourceProfile":"",
    "dataTargetProfile":"",
    "description":"",
    "jobTitle":"Group Job",
    "levelID":,
    "publishVariables":
    [
    {"name":"OBS_ENV","preResolveError":"","preResolveValue":"","value":""},
    {"name":"PRD_CD","preResolveError":"","preResolveValue":"","value":""}
    ],
    "seq":2,
    "vtfnodeID":"",
    "vtfnodeName":"",
    "iterations":1,
    "defaultPublishID":
    },
    { "batchEngineThread":"ANY",
    "dataSourceProfile":"",
    "dataTargetProfile":"",
    "description":"",
    "jobTitle":"Group Job",
    "levelID":,
    "publishVariables":
    [
    {"name":"REC_COUNT","preResolveError":"","preResolveValue":"","value":""},
    {"name":"OBS_ENV","preResolveError":"","preResolveValue":"","value":""}
    ],
    "seq":3,
    "vtfnodeID":"",
    "vtfnodeName":"",
    "iterations":1,
    "defaultPublishID":
    },
    { "batchEngineThread":"ANY",
    "dataSourceProfile":"",
    "dataTargetProfile":"",
    "description":"",
    "jobTitle":"Group Job",
    "levelID":,
    "publishVariables":
    [
    {"name":"OBS_ENV","preResolveError":"","preResolveValue":"","value":""}
    ],
    "seq":4,
    "vtfnodeID":"",
    "vtfnodeName":"",
    "iterations":1,
    "defaultPublishID":
    },
    { "batchEngineThread":"ANY",
    "dataSourceProfile":"",
    "dataTargetProfile":"",
    "description":"",
    "jobTitle":"Group Job",
    "levelID":,
    "publishVariables":
    [
    {"name":"REC_COUNT","preResolveError":"","preResolveValue":"","value":""},
    {"name":"OBS_ENV","preResolveError":"","preResolveValue":"","value":""}
    ],
    "seq":5,
    "vtfnodeID":"",
    "vtfnodeName":"",
    "iterations":1,
    "defaultPublishID":
    }
    ],
    "testMatches":[],
    "exportJobs":[],
    "selfServiceEmailMandate":false,
    "email":"",
    "globalThreadName":"ANY",
    "scheduledDateTimeInMillisec":"2018-09-11T00:08:56.284Z",
    "scheduledDateTimeInMillis":1536624540697,
    "currentDay":10,
    "currentMonth":9,
    "currentYear":2018,
    "globalSourceConnection":"",
    "globalTargetConnection":"",
    "jobSubmissionOrder":"1",
    "jobTitle":"",
    "username":""
    },
    "advancedToggleFlag":true,
    "dataDesign":
    {
    "projectID":4191,
    "versionID":4192
    }
    }



  • 4.  Re: Using REST POST method to POST a job in TDOD

    Posted 09-11-2018 10:42 AM

    Are you using TDoD or TDM Portal? I know you said TDoD in your original post, but many users still call Portal (the new component) TDoD (the old, deprecated, unsupported component).

     

    The first request that you posted appeared to be in the format for the Portal TDMJobService/api/ca/v1/jobs POST REST API. The most recent format I'm not familiar with.

     

    To make this easier, your best bet would be to run the request as desired within the UI (either TDoD or Portal) via Firefox, with the browser developer console open on the network tab. You can then right click on the request -> Copy Post data:

     

     

    This will provide you with the (valid) JSON used to run that request:

     

    {
        "name": "Publish_inst2-travel_Basic Car Details",
        "description": "Publish to inst2-travel using Basic Car Details",
        "projectId": 2200,
        "versionId": 2205,
        "type": "PUBLISHJOB",
        "origin": "generation",
        "scheduledTime": 1536676561862,
        "jobs": [],
        "parameters": {
            "variableDefaults": [],
            "generatorId": 2213,
            "jobType": "PUBLISH",
            "title": "Publish to inst2-travel using Basic Car Details",
            "publishTo": "TGT",
            "repeatCount": "1",
            "tables": [{
                "tableNo": 19,
                "tableName": "CAR_HIRE_CHAINS",
                "status": 1,
                "fileId": null
            }, {
                "tableNo": 20,
                "tableName": "CAR_TYPES",
                "status": 1,
                "fileId": null
            }, {
                "tableNo": 29,
                "tableName": "CAR_RENTAL_PROFILES",
                "status": 1,
                "fileId": null
            }, {
                "tableNo": 41,
                "tableName": "CAR_HIRE_OFFICES",
                "status": 1,
                "fileId": null
            }, {
                "tableNo": 47,
                "tableName": "CAR_AVAILABILITY",
                "status": 1,
                "fileId": null
            }],
            "actionOnDuplicate": "exit",
            "actionOnGenDuplicate": "exit",
            "target": "dbo",
            "dataTargetProfile": "inst2-travel",
            "dataSourceProfile": ""
        }
    }


  • 5.  Re: Using REST POST method to POST a job in TDOD

    Posted 09-11-2018 11:21 AM

    Thank Sean. I am referring to TDM Portal

     

    The request i shared was the one I took from the post you had shared.

    Using the TDM API to call a Specific Flow - CA Knowledge 

     

    I dont have firefox browser. Is there any way to get details from Chrome or IE.



  • 6.  Re: Using REST POST method to POST a job in TDOD

    Posted 09-11-2018 12:17 PM

    Chrome has similar functionality, but I don't think there is a way to get the raw JSON: