api reference

Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com>
This commit is contained in:
Hannah Hunter 2024-06-19 16:37:03 -04:00
parent a3b815653c
commit 35b67ce2a7
1 changed files with 33 additions and 19 deletions

View File

@ -17,19 +17,7 @@ With the jobs API, you can schedule jobs and tasks in the future.
Schedule a job with a name. Schedule a job with a name.
``` ```
$ curl -X POST \ POST http://localhost:3500/v1.0-alpha1/jobs/<name>
http://localhost:3500/v1.0-alpha1/job/schedule/<name> \
-H "Content-Type: application/json" \
-H 'dapr-app-id: <id>' \
-d '{
"job": {
"data": {
"@type": "type.googleapis.com/google.type.Expr",
"expression": "<expression>"
},
"dueTime": "30s"
}
}'
``` ```
### URL parameters ### URL parameters
@ -47,7 +35,7 @@ Parameter | Description
"job": { "job": {
"data": { "data": {
"@type": "type.googleapis.com/google.type.Expr", "@type": "type.googleapis.com/google.type.Expr",
"expression": "cassie87" "expression": "<expression>"
}, },
"dueTime": "30s" "dueTime": "30s"
} }
@ -64,14 +52,31 @@ Code | Description
### Response content ### Response content
The returned response is empty. The following example curl command creates a job, naming the job `test1` and specifying the `dueTime` and the `data`.
```bash
$ curl -X POST \
http://localhost:3500/v1.0-alpha1/jobs/test1 \
-H "Content-Type: application/json" \
-H 'dapr-app-id: sub' \
-d '{
"job": {
"data": {
"@type": "type.googleapis.com/google.type.Expr",
"expression": "expression1"
},
"dueTime": "30s"
}
}'
```
## Get job data ## Get job data
Get a job with its name. Get a job with its name.
``` ```
$ curl -X GET http://localhost:3500/v1.0-alpha1/job/<name> -H "Content-Type: application/json" -H 'dapr-app-id: <id>' GET http://localhost:3500/v1.0-alpha1/jobs/<name>
``` ```
### URL parameters ### URL parameters
@ -90,7 +95,11 @@ Code | Description
### Response content ### Response content
The returned response is JSON containing the `name` of the job, the `dueTime` and the`data`. After running the following example curl command, the returned response is JSON containing the `name` of the job, the `dueTime`, and the `data`.
```bash
$ curl -X GET http://localhost:3500/v1.0-alpha1/job/test1 -H "Content-Type: application/json" -H 'dapr-app-id: sub'
```
```json ```json
{ {
@ -107,7 +116,7 @@ The returned response is JSON containing the `name` of the job, the `dueTime` an
Delete a named job. Delete a named job.
``` ```
$ curl -X DELETE http://localhost:3500/v1.0-alpha1/job/<name> -H "Content-Type: application/json" -H 'dapr-app-id: <id>' DELETE http://localhost:3500/v1.0-alpha1/jobs/<name>
``` ```
### URL parameters ### URL parameters
@ -126,7 +135,12 @@ Code | Description
### Response content ### Response content
None. In the following example curl command, the job named `test1` with app-id `sub` will be deleted
```bash
$ curl -X DELETE http://localhost:3500/v1.0-alpha1/jobs/test -H "Content-Type: application/json" -H 'dapr-app-id: sub'
```
## Next steps ## Next steps