Advanced Configuration : Using Integration Manager APIs : Tutorial : Run a Configuration
 
Share this page                  
Run a Configuration
This section provides steps to run a new job on the job configuration. The parameters it accepts and the response codes are documented at https://api.im.actiandatacloud.com/apidocs/#/Job_Execution/runJobConfig.
This is a POST Request and the URL is http://localhost:8080/api/jobconfigs/<id>/jobs.
It accepts application/json as content type and Bearer Token as Authorization, and this information should be provided in the header.
Request Header
Content-Type: application/json
Authorization: Bearer <access token value>
It accepts the following request body. Enter the values for packageName, entryPoint; for packagePrefix enter the value “configuration\\<id>”, and for all other keys, replace “string” with empty or null or valid values or remove them. To run a job successfully, both job template and the job configuration active status should be true.
Request Body
{
    "outMessageNames": [
        "string"
    ],
    "logLevel": "SEVERE",
    "packageName": "string",
    "inMessages": [
        {
            "body": "string",
            "name": "string",
            "properties": [
                {
                    "value": "string",
                    "key": "string"
                }
            ]
        }
    ],
    "macros": [
        {
            "value": "string",
            "key": "string"
        }
    ],
    "entryPoint": "string",
    "packageArtifactOverride": true,
    "packagePrefix": "string",
    "packageVersion": "string",
    "variables": [
        {
            "value": "string",
            "key": "string"
        }
    ]
}
Here is the sample request that is sent to the API.
Sample Request – HTTP code snippet
POST /api/jobconfigs/44/jobs HTTP/1.1
Host: localhost:8080
Authorization: Bearer <access token value>
Content-Type: application/json
{
    "packageName": "packageA.djar",
    "entryPoint": "processA.process",
    "packagePrefix": "configuration\\44"
}
If the call is successful, status code 201 or 202 is returned with the following job configuration response body. It returns an “id” for the job that can be used in other job execution API calls to get the job info to check the status or to delete the job. To get the job information, use the GET /jobs/<id> endpoint.
Sample Response Body for status code: 201
{
    "href": "http://localhost:8080/api/jobs/3845bf5-6504-48dc-ab1e",
    "id": "3845bf5-6504-48dc-ab1e",
    "scheduled": "Apr 12, 2019 2:41:41 PM",
    "status": "QUEUED",
    "finalDestinationId": "1",
    "jobTemplate": {
        "id": "12ef65ae-9f7e-47cec3dcd1dfa859",
        "name": "sample template",
        "href": "http://localhost:8080/api/jobtemplates/12ef65ae-9f7e-47cec3dcd1dfa859"
    },
    "jobConfig": {
        "id": "44",
        "name": "sample config",
        "href": "http://localhost:8080/api/jobconfigs/44"
    },
    "submittedByUser": {
        "id": "1",
        "name": "admin",
    "href": "http://localhost:8080/api/users/1"
    }
}
If the call fails due to an expired token or invalid token, status code 401 Unauthorized is returned with an appropriate message.
If a wrong header or incorrect request body is sent, status code 400 Bad Request is returned. Also, when the job configuration active flag is set to false, API returns 400 Bad Request with the following message; update the job configuration active status to true and then run the job.
Sample Response Body when Job Configuration active status is false
{
    "message": "JobConfig Id 44 is not active"
}
Note:  In most of the REST clients, instead of using the access token in each call, you may set environment variables with the access token for your convenience.