ADN Open CIS
Сообщество программистов Autodesk в СНГ

03/04/2016

WorkItem в AutoCAD I/O API - часть 2

Чтобы получить WorkItem

GET autocad.io/us-east/v2/WorkItems('{my_id}')

Получитаем конкретный WorkItem

Пример успешного запроса:

Код - HTML: [Выделить]
  1. GET /autocad.io/us-east/v2/WorkItems('9688d314d6e94bc682f901b468ca8dbc') HTTP/1.1
  2. Accept: application/json
  3. Accept-Charset: UTF-8
  4. Authorization: Bearer my_token
  5. Host: autocad.io

Пример успешного ответа:

Код - HTML: [Выделить]
  1. HTTP/1.1 200 OK
  2. Cache-Control: no-cache
  3. Content-Type: application/json; charset=utf-8
  4. Date: Tue, 13 May 2014 00:29:38 GMT
  5. Expires: -1
  6. Pragma: no-cache
  7. Server: Microsoft-IIS/8.0
  8. X-AspNet-Version: 4.0.30319
  9. X-Powered-By: ASP.NET
  10. Content-Length: 2735
  11. Connection: keep-alive
  12.  
  13. {
  14.             "@odata.context":"https://developer-dev.api.autodesk.com/autocad.io/us-east/v2/$metadata#WorkItems/$entity","ActivityId":"PlotToPDF","Arguments":{
  15.                   "InputArguments":[
  16.                     {
  17.                           "Resource":"https://s3.amazonaws.com/AutoCAD-Core-Engine-Services/TestDwg/makeall.dwg","Name":"HostDwg","Headers":[
  18.  
  19.                           ],"ResourceKind":null,"StorageProvider":"Generic","HttpVerb":null
  20.                     }
  21.                   ],"OutputArguments":[
  22.                     {
  23.                           "Resource":"https://acesdev.s3-us-west-2.amazonaws.com/aces-workitem-outputs/9688d314d6e94bc682f901b468ca8dbc/result.pdf?AWSAccessKeyId=
  24.                           ASIAIIRAOVQYGB4OA7IA&Expires=1432231792&x-amz-security-token=AQoDYXdzEGIa0AMSDjA8SIKRwWVY8YvdmMQsZ3T5atGN2gDTUwcffe%2FMejuRGezSx%2F4lDaN1Nw
  25.                           sGCc%2B91eXvocmWaEZA%2Bm8uClMwP%2Fr69UmL6RmOiK7dokQlbQGEoPEQwF%2Frpw2jPQ6wDq4suFWXlsuxODWP24v3GJ4fZRj9V4S91Z59Nagcla6Ll46YVS6rc0PlaC4ElJ89n
  26.                           cABb23dR%2BK%2FAAaPsFVVn8ZV81gqDbect8YjvMH2RCfXQb7KnheNFlL77AXMeJM11ahq3UUsDk2o3uYQswJQJg5AsYZEtXjbbKU40MDkLPKjn5Ua18%2FD1pNZFm%2FFhoHMHXHv
  27.                           fvJdfXPWHBKYEFCvIz%2FZyKg8CORDIpK04ZMuAV68jTiHGkes7U5L5QPnCDEDAyZnod6FK7djcNYQwJBE9SNge%2FBLAXmJ5Hsiuy8HZF7GF59LPSR%2BXyygw%2Fy1ssJxmKxK4js
  28.                           UG33ukj69Mj1nXlKfVdk89cdonuOScw%2BnD91%2B1kRozlIXkDT9Crf%2FceshJHY48vaPtJ5VG1sGIZoHW5fzwcbXDEJzhLJcj0UaFr5N3sgMKCX7KtZcqRYp%2Bupd7khRSAhC2L
  29.                           ZdOyCHAQgi45F11qYZ8fwiUassVPEYIwTpYiDbgfOqBQ%3D%3D&Signature=02E4g51C2R9NsdwX0vloUmX8RCM%3D","Name":"Result","Headers":[
  30.                           ],"ResourceKind":null,"StorageProvider":"Generic","HttpVerb":"POST"
  31.                     }
  32.                   ]
  33.             },"Status":"Succeeded","StatusDetails":{
  34.                   "Report":"https://acesdev.s3-us-west-2.amazonaws.com/aces-workitem-reports/9688d314d6e94bc682f901b468ca8dbc/report.log?AWSAccessKeyId=ASIAIIRAOVQ
  35.                   YGB4OA7IA&Expires=1432231871&x-amz-security-token=AQoDYXdzEGIa0AMSDjA8SIKRwWVY8YvdmMQsZ3T5atGN2gDTUwcffe%2FMejuRGezSx%2F4lDaN1NwsGCc%2B91eXvocmWa
  36.                   EZA%2Bm8uClMwP%2Fr69UmL6RmOiK7dokQlbQGEoPEQwF%2Frpw2jPQ6wDq4suFWXlsuxODWP24v3GJ4fZRj9V4S91Z59Nagcla6Ll46YVS6rc0PlaC4ElJ89ncABb23dR%2BK%2FAAaPsFVV
  37.                   n8ZV81gqDbect8YjvMH2RCfXQb7KnheNFlL77AXMeJM11ahq3UUsDk2o3uYQswJQJg5AsYZEtXjbbKU40MDkLPKjn5Ua18%2FD1pNZFm%2FFhoHMHXHvfvJdfXPWHBKYEFCvIz%2FZyKg8COR
  38.                   DIpK04ZMuAV68jTiHGkes7U5L5QPnCDEDAyZnod6FK7djcNYQwJBE9SNge%2FBLAXmJ5Hsiuy8HZF7GF59LPSR%2BXyygw%2Fy1ssJxmKxK4jsUG33ukj69Mj1nXlKfVdk89cdonuOScw%2Bn
  39.                   D91%2B1kRozlIXkDT9Crf%2FceshJHY48vaPtJ5VG1sGIZoHW5fzwcbXDEJzhLJcj0UaFr5N3sgMKCX7KtZcqRYp%2Bupd7khRSAhC2LZdOyCHAQgi45F11qYZ8fwiUassVPEYIwTpYiDbgfO
  40.                   qBQ%3D%3D&Signature=omaAOII4CQaMUAXGChgsvT37I%2FU%3D"
  41.             },"AvailabilityZone":null,"TimeQueued":"2015-05-20T18:09:47.957Z","TimeInputTransferStarted":"2015-05-20T18:09:48.035Z","TimeScriptStarted":"2015-05-20T18:09:48.707Z",
  42.             "TimeScriptEnded":"2015-05-20T18:09:52.035Z","TimeOutputTransferEnded":"2015-05-20T18:09:52.16Z","BytesTranferredIn":169056,
  43.             "BytesTranferredOut":53800,"Id":"9688d314d6e94bc682f901b468ca8dbc","Version":1,"Timestamp":"2015-05-20T18:09:52.16Z"
  44.     }

Заголовки запроса

Заголовок запроса

Описание

Authorization

- Bearer my_token

     

Чтобы получить все WorkItems

POST autocad.io/us-east/v2/WorkItems

Получить все WorkItems

Пример успешного запроса:

Код - HTML: [Выделить]
  1. GET /autocad.io/us-east/v2/WorkItems HTTP/1.1
  2. Accept: application/json
  3. Accept-Charset: UTF-8
  4. Authorization: Bearer my_token
  5. Host: autocad.io

Пример успешного ответа:

Код - HTML: [Выделить]
  1. HTTP/1.1 200 OK
  2. Cache-Control: no-cache
  3. Content-Type: application/json; charset=utf-8
  4. Date: Mon, 12 May 2014 23:50:10 GMT
  5. Expires: -1
  6. Pragma: no-cache
  7. Server: Microsoft-IIS/8.0
  8. X-AspNet-Version: 4.0.30319
  9. X-Powered-By: ASP.NET
  10. Content-Length: 216490
  11. Connection: keep-alive
  12.  
  13. {
  14.   "odata.metadata":"https://developer.api.autodesk.com/autocad.io/us-east/v2/$metadata#WorkItems","value":[
  15.     {
  16.   "@odata.context":"https://developer-dev.api.autodesk.com/autocad.io/us-east/v2/$metadata#WorkItems/$entity","ActivityId":"PlotToPDF","Arguments":{
  17.                           "InputArguments":[
  18.                             {
  19.                                   "Resource":"https://s3.amazonaws.com/AutoCAD-Core-Engine-Services/TestDwg/makeall.dwg","Name":"HostDwg","Headers":[
  20.  
  21.                                   ],"ResourceKind":null,"StorageProvider":"Generic","HttpVerb":null
  22.                             }
  23.                           ],"OutputArguments":[
  24.                             {
  25.                                   "Resource":"https://acesdev.s3-us-west-2.amazonaws.com/aces-workitem-outputs/9688d314d6e94bc682f901b468ca8dbc/result.pdf?AWSAccessKeyId=
  26.                                   ASIAIIRAOVQYGB4OA7IA&Expires=1432231792&x-amz-security-token=AQoDYXdzEGIa0AMSDjA8SIKRwWVY8YvdmMQsZ3T5atGN2gDTUwcffe%2FMejuRGezSx%2F4lDaN1Nw
  27.                                   sGCc%2B91eXvocmWaEZA%2Bm8uClMwP%2Fr69UmL6RmOiK7dokQlbQGEoPEQwF%2Frpw2jPQ6wDq4suFWXlsuxODWP24v3GJ4fZRj9V4S91Z59Nagcla6Ll46YVS6rc0PlaC4ElJ89n
  28.                                   cABb23dR%2BK%2FAAaPsFVVn8ZV81gqDbect8YjvMH2RCfXQb7KnheNFlL77AXMeJM11ahq3UUsDk2o3uYQswJQJg5AsYZEtXjbbKU40MDkLPKjn5Ua18%2FD1pNZFm%2FFhoHMHXHv
  29.                                   fvJdfXPWHBKYEFCvIz%2FZyKg8CORDIpK04ZMuAV68jTiHGkes7U5L5QPnCDEDAyZnod6FK7djcNYQwJBE9SNge%2FBLAXmJ5Hsiuy8HZF7GF59LPSR%2BXyygw%2Fy1ssJxmKxK4js
  30.                                   UG33ukj69Mj1nXlKfVdk89cdonuOScw%2BnD91%2B1kRozlIXkDT9Crf%2FceshJHY48vaPtJ5VG1sGIZoHW5fzwcbXDEJzhLJcj0UaFr5N3sgMKCX7KtZcqRYp%2Bupd7khRSAhC2L
  31.                                   ZdOyCHAQgi45F11qYZ8fwiUassVPEYIwTpYiDbgfOqBQ%3D%3D&Signature=02E4g51C2R9NsdwX0vloUmX8RCM%3D","Name":"Result","Headers":[
  32.                                   ],"ResourceKind":null,"StorageProvider":"Generic","HttpVerb":"POST"
  33.                             }
  34.                           ]
  35.                     },"Status":"Succeeded","StatusDetails":{
  36.                           "Report":"https://acesdev.s3-us-west-2.amazonaws.com/aces-workitem-reports/9688d314d6e94bc682f901b468ca8dbc/report.log?AWSAccessKeyId=ASIAIIRAOVQ
  37.                           YGB4OA7IA&Expires=1432231871&x-amz-security-token=AQoDYXdzEGIa0AMSDjA8SIKRwWVY8YvdmMQsZ3T5atGN2gDTUwcffe%2FMejuRGezSx%2F4lDaN1NwsGCc%2B91eXvocmWa
  38.                           EZA%2Bm8uClMwP%2Fr69UmL6RmOiK7dokQlbQGEoPEQwF%2Frpw2jPQ6wDq4suFWXlsuxODWP24v3GJ4fZRj9V4S91Z59Nagcla6Ll46YVS6rc0PlaC4ElJ89ncABb23dR%2BK%2FAAaPsFVV
  39.                           n8ZV81gqDbect8YjvMH2RCfXQb7KnheNFlL77AXMeJM11ahq3UUsDk2o3uYQswJQJg5AsYZEtXjbbKU40MDkLPKjn5Ua18%2FD1pNZFm%2FFhoHMHXHvfvJdfXPWHBKYEFCvIz%2FZyKg8COR
  40.                           DIpK04ZMuAV68jTiHGkes7U5L5QPnCDEDAyZnod6FK7djcNYQwJBE9SNge%2FBLAXmJ5Hsiuy8HZF7GF59LPSR%2BXyygw%2Fy1ssJxmKxK4jsUG33ukj69Mj1nXlKfVdk89cdonuOScw%2Bn
  41.                           D91%2B1kRozlIXkDT9Crf%2FceshJHY48vaPtJ5VG1sGIZoHW5fzwcbXDEJzhLJcj0UaFr5N3sgMKCX7KtZcqRYp%2Bupd7khRSAhC2LZdOyCHAQgi45F11qYZ8fwiUassVPEYIwTpYiDbgfO
  42.                           qBQ%3D%3D&Signature=omaAOII4CQaMUAXGChgsvT37I%2FU%3D"
  43.                     },"AvailabilityZone":null,"TimeQueued":"2015-05-20T18:09:47.957Z","TimeInputTransferStarted":"2015-05-20T18:09:48.035Z","TimeScriptStarted":"2015-05-20T18:09:48.707Z",
  44.                     "TimeScriptEnded":"2015-05-20T18:09:52.035Z","TimeOutputTransferEnded":"2015-05-20T18:09:52.16Z","BytesTranferredIn":169056,
  45.                     "BytesTranferredOut":53800,"Id":"9688d314d6e94bc682f901b468ca8dbc","Version":1,"Timestamp":"2015-05-20T18:09:52.16Z"
  46.             }
  47.  
  48.   ],"odata.nextLink":"https://developer.api.autodesk.com/autocad.io/us-east/v2/WorkItems?$skip=100"
  49. }

Заголовки запроса

Заголовок запроса

Описание

Authorization

- Bearer my_token

     

Чтобы обновить WorkItem

Обновление WorkItem не допускается. После того, как он будет создан, вы не можете его изменить.

Для удаления WorkItem

DELETE autocad.io/us-east/v2/WorkItems('{my_id}')

Удалить конкретный WorkItem если они находятся в очереди, но не выполняется. Таким образом, вы должны удалить его сразу после его создания. Если он был выполнен, он не может быть удален.

Пример успешного запроса:

Код - HTML: [Выделить]
  1. DELETE /autocad.io/us-east/v2/WorkItems('9688d314d6e94bc682f901b468ca8dbc') HTTP/1.1
  2. Authorization: Bearer my_token

Пример успешного ответа:

Код - HTML: [Выделить]
  1. HTTP/1.1 204 No Content
  2. Cache-Control: no-cache
  3. Date: Mon, 12 May 2014 19:03:40 GMT
  4. Expires: -1
  5. Pragma: no-cache
  6. Server: Microsoft-IIS/8.0
  7. X-AspNet-Version: 4.0.30319
  8. X-Powered-By: ASP.NET
  9. Connection: keep-alive

Заголовки запроса

Заголовок запроса

Описание

Authorization

- Bearer my_token

Примечание: При Patch завершился успешно, он возвращает "204 No Content". В противном случае, вы получите другой статус ошибки.

Источник: https://developer.autodesk.com/api/autocadio/#workitem-api

Автор перевода: Дмитрий Емельянов

Обсуждение: http://adn-cis.org/forum/index.php?topic=

Опубликовано 03.04.2016