Variables in Rest API TdmJobService

Document ID : KB000106315
Last Modified Date : 02/01/2019
Show Technical Document Details
Question:
We are trying to use the RESTful API to publish some synthetic data in an Oracle Database, using the /TDMJobService/api/ca/v1/jobs End Point. We need to pass a value to a variable we use in that generator. However, the variable always returns the default value, and not the value you wish to pass. We read over the API documentation, but could not find anything to help us get around this issue, or a recommendation for doing what we need in this situation.

What is the best way to accomplish this?
Answer:
The best way to get the payload will be to publish the generator using chrome and then copying the payload from developer console (F12).

For example:
Generator with variables
User-added image

Publish to target
User-added image
Capture the traffic
User-added image

Below is the Payload for the request

{
               "name": "Publish_TEST_GEN1",
               "description": "Publish to TEST using GEN1",
               "projectId": 2352,
               "versionId": 2353,
               "type": "PUBLISHJOB",
               "origin": "generation",
               "scheduledTime": 1531496360001,
               "jobs": [],
               "parameters": {
                              "variableDefaults": [{
                                             "name": "ADD",
                                             "value": "ADD"
                              },
                              {
                                             "name": "CITY",
                                             "value": "CITY"
                              },
                              {
                                             "name": "FIRSTNAME",
                                             "value": "FIRSTNAME"
                              },
                              {
                                             "name": "ID",
                                             "value": "10"
                              },
                              {
                                             "name": "LASTNAME",
                                             "value": "LASTNAME"
                              }],
                              "generatorId": 2357,
                              "jobType": "PUBLISH",
                              "title": "Publish to TEST using GEN1",
                              "publishTo": "TGT",
                              "repeatCount": "1",
                              "tables": [{
                                             "tableNo": 1,
                                             "tableName": "Persons",
                                             "status": 1,
                                             "fileId": null
                              }],
                              "actionOnDuplicate": "exit",
                              "actionOnGenDuplicate": "exit",
                              "target": "dbo",
                              "dataTargetProfile": "TEST",
                              "dataSourceProfile": ""
               }
}