Skip to content

Commit ef73687

Browse files
committed
update rest api jobs and version
1 parent d24ecfe commit ef73687

File tree

3 files changed

+221
-20
lines changed

3 files changed

+221
-20
lines changed

articles/iot-central/core/howto-manage-data-export-with-rest-api.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Each data export definition can send data to one or more destinations. Create th
3434
Use the following request to create or update a destination definition:
3535

3636
```http
37-
PUT https://{subdomain}.{baseDomain}/api/dataExport/destinations/{destinationId}?api-version=1.2-preview
37+
PUT https://{subdomain}.{baseDomain}/api/dataExport/destinations/{destinationId}?api-version=2022-06-30-preview
3838
```
3939

4040
* destinationId - Unique ID for the destination.
@@ -75,7 +75,7 @@ The response to this request looks like the following example:
7575
Use the following request to retrieve details of a destination from your application:
7676

7777
```http
78-
GET https://{subdomain}.{baseDomain}/api/dataExport/destinations/{destinationId}?api-version=1.2-preview
78+
GET https://{subdomain}.{baseDomain}/api/dataExport/destinations/{destinationId}?api-version=2022-06-30-preview
7979
```
8080

8181
The response to this request looks like the following example:
@@ -96,7 +96,7 @@ The response to this request looks like the following example:
9696
Use the following request to retrieve a list of destinations from your application:
9797

9898
```http
99-
GET https://{subdomain}.{baseDomain}/api/dataExport/destinations?api-version=1.2-preview
99+
GET https://{subdomain}.{baseDomain}/api/dataExport/destinations?api-version=2022-06-30-preview
100100
```
101101

102102
The response to this request looks like the following example:
@@ -131,7 +131,7 @@ The response to this request looks like the following example:
131131
### Patch a destination
132132

133133
```http
134-
PATCH https://{subdomain}.{baseDomain}/api/dataExport/destinations/{destinationId}?api-version=1.2-preview
134+
PATCH https://{subdomain}.{baseDomain}/api/dataExport/destinations/{destinationId}?api-version=2022-06-30-preview
135135
```
136136

137137
You can use this to perform an incremental update to an export. The sample request body looks like the following example which updates the `displayName` to a destination:
@@ -163,15 +163,15 @@ The response to this request looks like the following example:
163163
Use the following request to delete a destination:
164164

165165
```http
166-
DELETE https://{subdomain}.{baseDomain}/api/dataExport/destinations/{destinationId}?api-version=1.2-preview
166+
DELETE https://{subdomain}.{baseDomain}/api/dataExport/destinations/{destinationId}?api-version=2022-06-30-preview
167167
```
168168

169169
### Create or update an export definition
170170

171171
Use the following request to create or update a data export definition:
172172

173173
```http
174-
PUT https://{subdomain}.{baseDomain}/api/dataExport/exports/{exportId}?api-version=1.2-preview
174+
PUT https://{subdomain}.{baseDomain}/api/dataExport/exports/{exportId}?api-version=2022-06-30-preview
175175
```
176176

177177
The following example shows a request body that creates an export definition for device telemetry:
@@ -233,7 +233,7 @@ The response to this request looks like the following example:
233233
Use the following request to retrieve details of an export definition from your application:
234234

235235
```http
236-
GET https://{subdomain}.{baseDomain}/api/dataExport/exports/{exportId}?api-version=1.2-preview
236+
GET https://{subdomain}.{baseDomain}/api/dataExport/exports/{exportId}?api-version=2022-06-30-preview
237237
```
238238

239239
The response to this request looks like the following example:
@@ -254,7 +254,7 @@ The response to this request looks like the following example:
254254
Use the following request to retrieve a list of export definitions from your application:
255255

256256
```http
257-
GET https://{subdomain}.{baseDomain}/api/dataExport/exports?api-version=1.2-preview
257+
GET https://{subdomain}.{baseDomain}/api/dataExport/exports?api-version=2022-06-30-preview
258258
```
259259

260260
The response to this request looks like the following example:
@@ -303,7 +303,7 @@ The response to this request looks like the following example:
303303
### Patch an export definition
304304

305305
```http
306-
PATCH https://{subdomain}.{baseDomain}/dataExport/exports/{exportId}?api-version=1.2-preview
306+
PATCH https://{subdomain}.{baseDomain}/dataExport/exports/{exportId}?api-version=2022-06-30-preview
307307
```
308308

309309
You can use this to perform an incremental update to an export. The sample request body looks like the following example which updates the `enrichments` to an export:
@@ -353,7 +353,7 @@ The response to this request looks like the following example:
353353
Use the following request to delete an export definition:
354354

355355
```http
356-
DELETE https://{subdomain}.{baseDomain}/api/dataExport/destinations/{destinationId}?api-version=1.2-preview
356+
DELETE https://{subdomain}.{baseDomain}/api/dataExport/destinations/{destinationId}?api-version=2022-06-30-preview
357357
```
358358

359359
## Next steps

articles/iot-central/core/howto-manage-jobs-with-rest-api.md

Lines changed: 210 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ The IoT Central REST API lets you develop client applications that integrate wit
1717
- List jobs and view job details in your application.
1818
- Create jobs in your application.
1919
- Stop, resume, and rerun jobs in your application.
20+
- Schedule Jobs and view scheduled job details in your application.
2021

2122
> [!IMPORTANT]
22-
> The jobs API is currently in preview. All The REST API calls described in this article should include `?api-version=1.2-preview`.
23+
> The jobs API is currently in preview. All The REST API calls described in this article should include `?api-version=2022-06-30-preview`.
2324
2425
This article describes how to use the `/jobs/{job_id}` API to control devices in bulk. You can also control devices individually.
2526

@@ -91,7 +92,7 @@ The following table describes the fields in the previous JSON snippet:
9192
Use the following request to retrieve the list of the jobs in your application:
9293

9394
```http
94-
GET https://{your app subdomain}.azureiotcentral.com/api/jobs?api-version=1.2-preview
95+
GET https://{your app subdomain}.azureiotcentral.com/api/jobs?api-version=2022-06-30-preview
9596
```
9697

9798
The response to this request looks like the following example:
@@ -160,7 +161,7 @@ The response to this request looks like the following example:
160161
Use the following request to retrieve an individual job by ID:
161162

162163
```http
163-
GET https://{your app subdomain}.azureiotcentral.com/api/jobs/job-004?api-version=1.2-preview
164+
GET https://{your app subdomain}.azureiotcentral.com/api/jobs/job-004?api-version=2022-06-30-preview
164165
```
165166

166167
The response to this request looks like the following example:
@@ -195,7 +196,7 @@ The response to this request looks like the following example:
195196
Use the following request to retrieve the details of the devices in a job:
196197

197198
```http
198-
GET https://{your app subdomain}.azureiotcentral.com/api/jobs/job-004/devices?api-version=1.2-preview
199+
GET https://{your app subdomain}.azureiotcentral.com/api/jobs/job-004/devices?api-version=2022-06-30-preview
199200
```
200201

201202
The response to this request looks like the following example:
@@ -228,7 +229,7 @@ The response to this request looks like the following example:
228229
Use the following request to create a job:
229230

230231
```http
231-
PUT https://{your app subdomain}.azureiotcentral.com/api/jobs/job-006?api-version=1.2-preview
232+
PUT https://{your app subdomain}.azureiotcentral.com/api/jobs/job-006?api-version=2022-06-30-preview
232233
```
233234

234235
The `group` field in the request body identifies a device group in your IoT Central application. A job uses a device group to identify the set of devices the job operates on.
@@ -237,7 +238,7 @@ The `group` field in the request body identifies a device group in your IoT Cent
237238
If you don't already have a suitable device group, you can create one with REST API call. The following example creates a device group with `group1` as the group ID:
238239

239240
```http
240-
PUT https://{subdomain}.{baseDomain}/api/deviceGroups/group1?api-version=1.2-preview
241+
PUT https://{subdomain}.{baseDomain}/api/deviceGroups/group1?api-version=2022-06-30-preview
241242
```
242243

243244
When you create a device group, you define a `filter` that selects the devices to include in the group. A filter identifies a device template and any properties to match. The following example creates device group that contains all devices associated with the "dtmi:modelDefinition:dtdlv2" device template where the `provisioned` property is `true`.
@@ -323,23 +324,223 @@ The response to this request looks like the following example. The initial job s
323324
Use the following request to stop a running job:
324325

325326
```http
326-
POST https://{your app subdomain}.azureiotcentral.com/api/jobs/job-006/stop?api-version=1.2-preview
327+
POST https://{your app subdomain}.azureiotcentral.com/api/jobs/job-006/stop?api-version=2022-06-30-preview
327328
```
328329

329330
If the request succeeds, it returns a `204 - No Content` response.
330331

331332
Use the following request to resume a stopped job:
332333

333334
```http
334-
POST https://{your app subdomain}.azureiotcentral.com/api/jobs/job-006/resume?api-version=1.2-preview
335+
POST https://{your app subdomain}.azureiotcentral.com/api/jobs/job-006/resume?api-version=2022-06-30-preview
335336
```
336337

337338
If the request succeeds, it returns a `204 - No Content` response.
338339

339340
Use the following command to rerun an existing job on any failed devices:
340341

341342
```http
342-
PUT https://{your app subdomain}.azureiotcentral.com/api/jobs/job-006/rerun/rerun-001?api-version=1.2-preview
343+
PUT https://{your app subdomain}.azureiotcentral.com/api/jobs/job-006/rerun/rerun-001?api-version=2022-06-30-preview
344+
```
345+
346+
## Create a scheduled job
347+
348+
Use the following request to create a scheduled job
349+
350+
```http
351+
PUT https://{your app subdomain}.azureiotcentral.com/api/scheduledJobs/scheduled-Job-001?api-version=2022-06-30-preview
352+
```
353+
354+
The following example shows a request body that creates a scheduled job.
355+
356+
```json
357+
{
358+
"displayName": "New Scheduled Job",
359+
"group": "6fecf96f-a26c-49ed-8076-6960f8efba31",
360+
"data": [
361+
{
362+
"type": "cloudProperty",
363+
"target": "dtmi:azurertos:devkit:hlby5jgib2o",
364+
"path": "Company",
365+
"value": "Contoso"
366+
}
367+
],
368+
"schedule": {
369+
"start": "2022-10-24T22:29:01Z",
370+
"recurrence": "daily"
371+
}
372+
}
373+
```
374+
375+
The response to this request looks like the following example:
376+
377+
```json
378+
{
379+
"id": "scheduled-Job-001",
380+
"displayName": "New Scheduled Job",
381+
"description": "",
382+
"group": "6fecf96f-a26c-49ed-8076-6960f8efba31",
383+
"data": [
384+
{
385+
"type": "cloudProperty",
386+
"target": "dtmi:azurertos:devkit:hlby5jgib2o",
387+
"path": "Company",
388+
"value": "Contoso"
389+
}
390+
],
391+
"schedule": {
392+
"start": "2022-10-24T22:29:01Z",
393+
"recurrence": "daily"
394+
},
395+
"enabled": false,
396+
"completed": false,
397+
"etag": "\"88003877-0000-0700-0000-631020670000\""
398+
}
399+
```
400+
401+
## Get a scheduled job
402+
403+
Use the following request to get a scheduled job
404+
405+
```http
406+
GET https://{your app subdomain}.azureiotcentral.com/api/scheduledJobs/scheduled-Job-001?api-version=2022-06-30-preview
407+
```
408+
409+
The response to this request looks like the following example:
410+
411+
```json
412+
{
413+
"id": "scheduled-Job-001",
414+
"displayName": "New Scheduled Job",
415+
"description": "",
416+
"group": "6fecf96f-a26c-49ed-8076-6960f8efba31",
417+
"data": [
418+
{
419+
"type": "cloudProperty",
420+
"target": "dtmi:azurertos:devkit:hlby5jgib2o",
421+
"path": "Company",
422+
"value": "Contoso"
423+
}
424+
],
425+
"schedule": {
426+
"start": "2022-10-24T22:29:01Z",
427+
"recurrence": "daily"
428+
},
429+
"enabled": false,
430+
"completed": false,
431+
"etag": "\"88003877-0000-0700-0000-631020670000\""
432+
}
433+
```
434+
435+
## List Scheduled Jobs
436+
437+
Use the following request to get a list of scheduled jobs
438+
439+
```http
440+
GET https://{your app subdomain}.azureiotcentral.com/api/scheduledJobs?api-version=2022-06-30-preview
441+
```
442+
443+
The response to this request looks like the following example:
444+
445+
```json
446+
{
447+
"value": [
448+
{
449+
"id": "scheduled-Job-001",
450+
"displayName": "New Scheduled Job",
451+
"description": "",
452+
"group": "6fecf96f-a26c-49ed-8076-6960f8efba31",
453+
"data": [
454+
{
455+
"type": "cloudProperty",
456+
"target": "dtmi:azurertos:devkit:hlby5jgib2o",
457+
"path": "Company",
458+
"value": "Contoso"
459+
}
460+
],
461+
"schedule": {
462+
"start": "2022-10-24T22:29:01Z",
463+
"recurrence": "daily"
464+
},
465+
"enabled": false,
466+
"completed": false,
467+
"etag": "\"88003877-0000-0700-0000-631020670000\""
468+
},
469+
{
470+
"id": "46480dff-dc22-4542-924e-a5d45bf347aa",
471+
"displayName": "test",
472+
"description": "",
473+
"group": "cdd04344-bb55-425b-a55a-954d68383289",
474+
"data": [
475+
{
476+
"type": "cloudProperty",
477+
"target": "dtmi:rigado:evxfmi0xim",
478+
"path": "test",
479+
"value": 2
480+
}
481+
],
482+
"schedule": {
483+
"start": "2022-09-01T03:00:00.000Z"
484+
},
485+
"enabled": true,
486+
"completed": true,
487+
"etag": "\"88000f76-0000-0700-0000-631020310000\""
488+
}
489+
]
490+
}
491+
```
492+
493+
## Update a scheduled job
494+
495+
Use the following request to update a scheduled job
496+
497+
```http
498+
PATCH https://{your app subdomain}.azureiotcentral.com/api/scheduledJobs/scheduled-Job-001?api-version=2022-06-30-preview
499+
```
500+
501+
The following example shows a request body that updates a scheduled job.
502+
503+
```json
504+
{
505+
"schedule": {
506+
"start": "2022-10-24T22:29:01Z",
507+
"recurrence": "weekly"
508+
}
509+
}
510+
```
511+
512+
The response to this request looks like the following example:
513+
514+
```json
515+
{
516+
"id": "scheduled-Job-001",
517+
"displayName": "New Scheduled Job",
518+
"description": "",
519+
"group": "6fecf96f-a26c-49ed-8076-6960f8efba31",
520+
"data": [
521+
{
522+
"type": "cloudProperty",
523+
"target": "dtmi:azurertos:devkit:hlby5jgib2o",
524+
"path": "Company",
525+
"value": "Contoso"
526+
}
527+
],
528+
"schedule": {
529+
"start": "2022-10-24T22:29:01Z",
530+
"recurrence": "weekly"
531+
},
532+
"enabled": false,
533+
"completed": false,
534+
"etag": "\"88003877-0000-0700-0000-631020670000\""
535+
}
536+
```
537+
538+
## Delete a scheduled job
539+
540+
Use the following request to delete a scheduled job
541+
542+
```http
543+
GET https://{your app subdomain}.azureiotcentral.com/api/scheduledJobs/scheduled-Job-001?api-version=2022-06-30-preview
343544
```
344545

345546
## Next steps

articles/iot-central/core/howto-query-with-rest-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ To learn how to query devices by using the IoT Central UI, see [How to use data
3737
Use the following request to run a query:
3838

3939
```http
40-
POST https://{your app subdomain}.azureiotcentral.com/api/query?api-version=1.2-preview
40+
POST https://{your app subdomain}.azureiotcentral.com/api/query?api-version=2022-06-30-preview
4141
```
4242

4343
The query is in the request body and looks like the following example:

0 commit comments

Comments
 (0)