Please enable JavaScript to view this site.

The manual for the JobRouter developer

For tagging one or several documents with new index data, the following routes are available:

PATCH /application/jobarchive/archives/:archive/documents/:revisionId/indexdata – Update index data of a document revision. The document ID is transferred in the parameter revisionId. The index data is transferred in the request body. In this route only the modified index data is transferred.

PUT /application/jobarchive/archives/:archive/documents/:revisionId/indexdata – Update index data of a document revision.The document ID is transferred in the parameter revisionId. The index data is transferred in the request body. In this route you have to transfer all index data.

PATCH /application/jobarchive/archives/:archive/indexdata Update index data of several documents of one archive. The document ID and the new index data is transferred in the request body. Only indicate the modified index data.

PUT /application/jobarchive/archives/:archive/indexdata Update index data of several documents of one archive. The document ID and the new index data is transferred in the request body. In this route all index fields have to be provided with values.

With the archive parameter you determine the archive (archive GUID or archive table).

The response is in JSON format and includes all index data.

Response for the routes for one document revision:

{

    "archivedocumentrevisions": [

        {

            "revisionId": "12345",

            "indexFields": [

                ...

            ],

            "keywordFields": [

                ...

            ]

        }

    ]

}

Response for the routes for several document revisions:

{

    "archivedocumentrevisions": [

        {

            "revisionId": "12345",

            "indexFields": [

                ...

            ],

            "keywordFields": [

                ...

            ]

        },

        {

            "revisionId": "14699",

            "indexFields": [

                ...

            ],

            "keywordFields": [

                ...

            ]

        }

    ]

}

Example: Modifie index data for several documents

guzzlehttp

// User has been authenticated already

 

$revisionIds = [123, 124];

$revisions = [];

// Indexdaten definieren

foreach ($revisionIds as $id) {

    $revisionData = [

        'revisionId' => $id,

        'indexFields' => [

            [

                'name' => 'check_status',

                'value' => 'approved',

            ],

        ],

    ];

    $revisions[] = $revisionData;

}

 

$indexData = [

    'revisions' => $revisions,

];

 

try {

 

    $response = $client->request(

        'PATCH',

        'application/jobarchive/archives/invoices/indexdata,

        [

            'json' => $indexData,

        ]

    );

} catch (Exception $e) {

    echo "Error during performance: " . $e->getMessage() . "\n";

}

 

// Finish user session

cURL

// User has been authenticated already

 

// Define index fields

$indexData = [

    'revisions' => [

        [

            'revisionId' => '123',

            'indexFields'  => [

                [

                    'name' => 'check_status',

                    'value' => 'approved',

                ]

            ]

        ],

        [

            'revisionId' => '124',

            'indexFields'  => [

                [

                    'name' => 'check_status',

                    'value' => 'approved',

                ]

            ]

        ],

    ]

];

 

curl_setopt($curlHandle, CURLOPT_URL,

    'http://example.org/jobrouter/api/rest/v2/application/jobarchive/' .

    'archives/invoices/indexdata);

curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);

curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, 'PATCH');

curl_setopt($curlHandle, CURLOPT_POSTFIELDS, json_encode($indexData));

curl_setopt($curlHandle, CURLOPT_COOKIEFILE, 'path/to/cookie/file.cookie');

 

$response = curl_exec($curlHandle);

$statusCode = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE);

 

curl_close();

 

if ($statusCode !== 200) {

    echo "Error during performance: Code - " . $statusCode . ", ";

    echo "Response: " . var_export($response, true);

}

 

// Finish user session