...
Map the
...
Public Document Reference: - https://zephyrenterprisev3.docs.apiary.io/#reference/fieldmap/create-field-map/create-field-map
...
fields
Use the following operation to map fields in Zephyr Enterprise:
POST /flex/services/rest/v3/fieldmap
Request format
To map fields, send a POST request to the following URL:
http://{ZEPHYR-SERVER}/flex/services/rest/
latestv3/fieldmap
/
Method: - POST
Add The New Job
...
Import Job via Excel (Only xlsx format Supported)
Public Document Reference: - https://zephyrenterprisev3.docs.apiary.io/#reference/import/add-new-import-job/add-new-import-job
Method: - POST
End Point: -
Sample request
Code Block |
---|
{
"name": "Map1",
"description": "",
"startingRowNumber": 2,
"discriminator": "byidchange",
"fieldMapDetails": [
{
"displayName": "Name *",
"zephyrField": 1,
"mappedField": "B",
"mandatory": true
},
{
"displayName": "Test Steps *",
"zephyrField": 2,
"mappedField": "D",
"mandatory": true
},
{
"displayName": "Expected Results *",
"zephyrField": 3,
"mappedField": "F",
"mandatory": true
},
{
"displayName": "Alt Id *",
"zephyrField": 21,
"mappedField": "A",
"mandatory": true
},
{
"displayName": "TestData",
"zephyrField": 22,
"mappedField": "E",
"mandatory": false
},
{
"displayName": "Priority",
"zephyrField": 23,
"mappedField": "G",
"mandatory": false
}
],
"fieldMapEntityType": "testcase",
"projectId": 1
} |
startingRownumber - The number of the row in an Excel sheet where you will start mapping by using a discriminator. The following discriminators are available:
By ID change
By empty row
By test case name change
Sample response
Code Block |
---|
{
"id": 1,
"name": "Map1",
"description": "",
"creationDate": 1595932827461,
"projectId": 1,
"startingRowNumber": 2,
"discriminator": "byidchange",
"fieldMapDetails": [
{
"zephyrField": "1",
"mappedField": "B"
},
{
"zephyrField": "2",
"mappedField": "D"
},
{
"zephyrField": "21",
"mappedField": "A"
},
{
"zephyrField": "3",
"mappedField": "F"
},
{
"zephyrField": "22",
"mappedField": "E"
},
{
"zephyrField": "23",
"mappedField": "G"
}
],
"fieldMapEntityType": "testcase"
} |
Create an import job
Use the following operation to create an import job in Zephyr Enterprise:
POST /flex/services/rest/v3/import
Request format
To create an import job, send a POST request to the following URL:
http://{ZEPHYR-SERVER}/flex/services/rest/v3/import
/Request Body: -
Sample request
Code Block | ||
---|---|---|
| ||
{ "name": "Job_NameJob1", "scheduledDate": 16946720456291595934198708, "folder": "tc_import_utf8_DO_NOT_DELETE"/home/zephyr/zephyr/nodedata/temp/%2F1595939009589_0%2F20testcase.xlsx", "fileExtension": ".xls", "fieldMapId": 41, "releaseId": 1, "importEntityType": "testcase", "status": "11000", "isUpload": truefalse } |
Request Response: -
...
folder - the folder where the file will be downloaded first. /home/zephyr/zephyr
is the location of the Zephyr installation directory.
fieldMapId = The ID of the map containing the mapping details.
Sample response
Code Block | ||
---|---|---|
| ||
{ "id": 14, "name": "Job_Name Job1", "folder": "tc_import_utf8_DO_NOT_DELETE/home/zephyr/zephyr/nodedata/temp/%2F1595939009589_0%2F20testcase.xlsx", "fileExtension": ".xls", "scheduledDate": 16946720456291595934198708, "status": "11000", "fieldMap": { "id": 41, "name": "MapMap1", "description": "", "creationDate": 16945884000001595833200000, "projectId": 13, "startingRowNumber": 2, "discriminator": "bytestcasenamechangebyidchange", "fieldMapDetails": [ { "zephyrField": "1", "mappedField": "BE" }, { "zephyrField": "2", "mappedField": "DG" }, { "zephyrField": "21", "mappedField": "AD" }, { "zephyrField": "3", "mappedField": "FI" }, { "zephyrField": "22", "mappedField": "EH" } ], "fieldMapEntityType": "testcase" }, "fieldMapId": 4, "releaseId": 1, "importEntityType": "testcase", "isUpload": truefalse } |
Upload the Excel file
Public Document Reference: - Add an Attachment
Method: - POST
End Point: - NOTE: The first file needs to be uploaded by using the genericattachment call. You will get a tempFilePath in the response. This path needs to be used in the API above.
To call genericattachment
, use the following operation:
POST /flex/upload/document/genericattachment
?jobid= {JobID from the above API}Example: -
Send a POST request to the following URL:
http://{ZEPHYR-SERVER}/flex/upload/document/genericattachment
?jobid=1
In Body select the form-data and add
Key name: - import and select the type as a file.
Key value adds the attachment.
See the below Example: -
Execute import job by id
Public Document Reference :- https://zephyrenterprisev3.docs.apiary.io/#reference/import/execute-import-job-by-id/execute-import-job-by-id
Method :- PUT
End Point: -
Sample response
Code Block |
---|
[
{
"fileName": "20testcase.xlsx",
"dateCreated": "null",
"fieldName": "data",
"tempFilePath": "%2F1595939009589_0%2F20testcase.xlsx",
"description": "null",
"contentType": "application/octet-stream"
}
] |
Run the import job
Use the following operation to run the import job:
PUT /flex/services/rest/v3/import/execute/{
JobIDid}/{action}
{id} - the ID of the import job.
{action} - run
Example: - .
Request format
To run the import job, send a PUT request to the following URL:
http://{ZEPHYR-SERVER}/flex/services/rest/v3/import/execute
/1/
run
Body: -
...
{
...
Example Body: -
...
id}/{action}
Sample request
Code Block | ||
---|---|---|
| ||
{ "id": 15, "action": "run" } |
...