Test Data Manager

 View Only

(Quick) Tech Tip: Copy REST API Request From a Browser

By Sean-K-CA posted Oct 03, 2018 12:06 PM

  

Building the exact syntax for a REST API call to automate an operation can be difficult and/or time consuming. To make this easier and quicker, setup exactly want is needed within Portal and use the Browsers developer console to copy the JSON or even the full request as a cURL command.  The Browser console can generally be accessed by pressing "F12" on your keyboard while logged into Portal. Head on over to the Network tab and you'll see all of the requests that have been made.

 

Here's an example from Firefox:

 

The output of "Copy POST Data" for this request looks like this:

{
    "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": ""
    }
}

 

Chrome has similar options as well (again "F12" while in Portal, and head over to the Network tab):

1 comment
44 views

Permalink