Starts new job

POST
api/databases/{dbid}/jobs/{jname}
This request is used for starting a new job. Jobs are mainly used for batch operations, when there is a need break a large operation into several smaller operations in order to avoid blocking the tables for a long time.

Request:

Argument Type Description
dbid GUID  The ID of the database
jname String  The name of the job

Content

Name Description
Object  New job data
In the content you need to specify the data object corresponding job
The following types of work
Job name Content Description
ExtractFromArchEntities details
DuplicateEntities details Batch duplicate entities job
PutToArchEntities details
DatabaseDataRefresh details Database data refreshing job
TaskShifting details Batch task shifting job

Response:

Content

Name Type Options Description
Exception Exception  Job error info
JobId GUID  Job id
Progress JobProgressData  Job progress data
Request JobRequestData  Job request data
Status Integer  Job current status

Request:
  1. POST api/databases/ec5a34c2-7062-4be7-ade9-c15acefcdbb8/jobs/duplicateentities
  2. Accept: text/json
  3. Accept-Encoding: deflate
  4. Host: localhost:6496
  5. Cookie: sid=bc6ef8bc-1de7-49ec-a929-7644fcf51911
  6. Connection: Keep-Alive
  7.  
  8. {
  9. "DuplicatedFields": [
  10. "name",
  11. "estimate"
  12. ],
  13. "EntityMetaName": "task",
  14. "InitialIds": [
  15. "277b190f-bf83-434e-ad31-09010e9ca072",
  16. "96611d6e-53f4-4f4b-b41a-82093f9fda9c",
  17. "98345828-304d-4b78-a8b4-3da1e6a306a2",
  18. "e1597548-cc5d-4d51-99fc-819a62cdaa9a",
  19. "70abbc97-5f08-463e-8b81-d4b8a3bbf4a4",
  20. "3db8781c-bf45-4473-b16b-c4f0df8d64b5",
  21. "747b8168-16b4-4595-85f6-9eea59b0fc87",
  22. "a45adb38-6db4-46da-ab79-01ee2df689f8",
  23. "d2489831-b04d-4b1c-bf70-e20e0713572f",
  24. "0ca18e4a-1264-44f4-93b2-d9e3ce0fbcac",
  25. "42ec2115-1147-4712-8f97-7c1b9460337a",
  26. "12ecdc03-d1de-454e-b88d-e38b6936d091",
  27. "d56ce629-53dc-42cc-b951-1f064a50d69a",
  28. "5a699d21-bd60-47b1-8abb-0dfaa7c6b5a6",
  29. "d41ec2ef-dde9-4648-8b1f-bb5b68db26e1",
  30. "d4e3c403-28f8-46e9-9aa9-f4ccb99fd3a5",
  31. "3ee3a1cd-a133-47de-ad04-b68d72e3e24a",
  32. "ca3dd8d5-8443-4e1a-994a-eb92e0430a8e",
  33. "5629504c-9fe7-4b35-8a6c-5d57f634906c",
  34. "d45e464a-b209-4d77-a989-ebec33ef0ddd"
  35. ],
  36. "Comment": "Duplicated task"
  37. }
Response:
  1. Cache-Control: no-store
  2. Date: Mon, 24 Dec 2012 16:47:29 GMT
  3. Server: Microsoft-HTTPAPI/2.0
  4.  
  5. {
  6. "JobId": "767ede8a-593f-4527-b08e-9b066fdb027e",
  7. "Status": 0 //Pending start
  8. }

This request can be send periodically to check the status and progress of job, until it returns the status Closed (3).

Request:
  1. GET api/databases/ec5a34c2-7062-4be7-ade9-c15acefcdbb8/jobs/767ede8a-593f-4527-b08e-9b066fdb027e
  2. Accept: text/json
  3. Accept-Encoding: deflate
  4. Host: localhost:6496
  5. Cookie: sid=bc6ef8bc-1de7-49ec-a929-7644fcf51911
  6. Connection: Keep-Alive
Response:
  1. Cache-Control: no-store
  2. Date: Mon, 24 Dec 2012 16:47:29 GMT
  3. Server: Microsoft-HTTPAPI/2.0
  4.  
  5. {
  6. "JobId": "767ede8a-593f-4527-b08e-9b066fdb027e",
  7. "Progress": {
  8. "Message": "",
  9. "Percent": 25.0
  10. },
  11. "Request": {
  12. "",
  13. },
  14. "Status": 1 //Running
  15. }

If job is in state 'WaitingResponse' (2), you will get the message and a set of buttons in the field "Request". You need to display the message (or solve this situation on program level) and send request with selected button (buttons index is Zero based, i.e. first button has 0 value). For example, if you get message: "Can not duplicate the problem 'Task1'. Continue?", with buttons: "Yes", "Yes to All", "None.", you can select button "Yes to All" and send the request: { "Response": { "ButtonIndex": 1 }, }

Request:
  1. PUT api/databases/ec5a34c2-7062-4be7-ade9-c15acefcdbb8/jobs/767ede8a-593f-4527-b08e-9b066fdb027e
  2. Accept: text/json
  3. Accept-Encoding: deflate
  4. Host: localhost:6496
  5. Cookie: sid=bc6ef8bc-1de7-49ec-a929-7644fcf51911
  6. Connection: Keep-Alive
  7.  
  8. {
  9. "Response": {
  10. "ButtonIndex": 1
  11. },
  12. }
Response:
  1. Cache-Control: no-store
  2. Date: Mon, 24 Dec 2012 16:47:29 GMT
  3. Server: Microsoft-HTTPAPI/2.0
  4.  
  5. {
  6. "JobId": "767ede8a-593f-4527-b08e-9b066fdb027e",
  7. "Progress": {
  8. "Message": "",
  9. "Percent": 50.0
  10. },
  11. "Status": 1 //Running
  12. }

This request is only for the premature termination of Job

Request:
  1. DELETE api/databases/ec5a34c2-7062-4be7-ade9-c15acefcdbb8/jobs/767ede8a-593f-4527-b08e-9b066fdb027e
  2. Accept: text/json
  3. Accept-Encoding: deflate
  4. Host: localhost:6496
  5. Cookie: sid=bc6ef8bc-1de7-49ec-a929-7644fcf51911
  6. Connection: Keep-Alive
Response:
  1. Cache-Control: no-store
  2. Date: Mon, 24 Dec 2012 16:47:29 GMT
  3. Server: Microsoft-HTTPAPI/2.0