Experian API call to Execute Workflow

hi,

Can someone help me with the JSON request to invoke a workflow through REST API?

Below are my workflow specification

a. Workflow accepts workflow parameters

b Workflow accepts source at execution and its mandatory to give source information.

Best Answer

  • Henry Simms
    Henry Simms Administrator
    edited September 9 Answer ✓

    Hi @Shreya . I'd highly recommend using the interactive API provided by swagger UI to craft and test your REST API calls.

    The approach I usually recommend is to build up your request a bit at a time, starting just with a simple call to execute a workflow (without providing parameters or supplying a non-default source. An example of this would be the call:

    {
    "externalLabel": "uppercase_append",
    "spaceExternalLabel": "WorkflowExecution",
    "versionToExecute": "PublishedOnly",
    "dependenciesToUse": "PublishedOnly",
    "refreshSources": false
    }

    Check in the Data Studio Job list that the workflow has executed successfully, initiated by the API and the user associated with the token:

    Having got that working, try creating a workflow parameter and then passing the value of it:

    {
    "externalLabel": "uppercase_append",
    "spaceExternalLabel": "WorkflowExecution",
    "versionToExecute": "PublishedOnly",
    "dependenciesToUse": "PublishedOnly",
    "refreshSources": false
    ,
    "workflowParameters": {
    "append_string": "hello!"
    }

    }

    By looking in the job's execution details, you can check that the parameter was applied correctly when the workflow was executed:

    Finally, replace the source used in the workflow with a different Dataset (different schema), and be sure to map any columns that are used in the workflow to columns in the new source:

    {
    "externalLabel": "uppercase_append",
    "spaceExternalLabel": "WorkflowExecution",
    "versionToExecute": "PublishedOnly",
    "dependenciesToUse": "PublishedOnly",
    "refreshSources": false,
    "workflowParameters": {
    "append_string": "hello!"
    },
    "sources": [
    {
    "stepExternalLabel": "primary_source",
    "sourceExternalLabel": "test_file_5",
    "columnMappings": [
    {
    "originalColumn": "name",
    "newColumn": "new name"
    }
    ]
    }
    ]

    }

    Job details will now show the workflow run successfully with the new source replacing the default:

    I've attached the metadata (workflow, datasets, test data values) used in this example, which will work in versions 2.14.9 and above. You'll need to provide your own API token.

    cURL for these calls is:

    "https://<you hostname>/api/default/jobs" -H "accept: application/json" -H "Authorization: default <your API token>" -H "Content-Type: application/json -d "<body of the request>"