Skip to content

Commit 55fb8da

Browse files
authored
rename to api and include status progress (#36)
* rename to api and include status progress * fix errors
1 parent f202dc4 commit 55fb8da

4 files changed

Lines changed: 43 additions & 36 deletions

File tree

api/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# API
2+
3+
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ionq-samples/getting-started/blob/main/curl/main.ipynb)
4+
5+
---
6+
7+
Get your API key from <https://cloud.ionq.com/settings/keys>.
8+
9+
## Submit a Job:
10+
11+
```shell
12+
curl -X POST "https://api.ionq.co/v0.3/jobs" \
13+
-A "curl/$(curl --version | awk 'NR==1 {print $2}')" \
14+
-H "Authorization: apiKey $IONQ_API_KEY" \
15+
-H "Content-Type: application/json" \
16+
-d @data.json
17+
```
18+
19+
> {"id":"7cc8ce51-2e57-4140-96ce-cf8bada0bf91","status":"ready","request":1691469978}
20+
21+
Use `id` to query the job.
22+
23+
## Query a Job:
24+
25+
```shell
26+
curl "https://api.ionq.co/v0.3/jobs/7cc8ce51-2e57-4140-96ce-cf8bada0bf91" \
27+
-H "Authorization: apiKey $IONQ_API_KEY"
28+
```
29+
30+
> {"noise":{"model":"ideal"},"status":"submitted","children":[],"target":"simulator","id":"7cc8ce51-2e57-4140-96ce-cf8bada0bf91","request":1691469978}
31+
32+
> {"noise":{"model":"ideal"},"status":"completed","children":[],"target":"simulator","predicted_execution_time":4,"execution_time":26,"id":"7cc8ce51-2e57-4140-96ce-cf8bada0bf91","qubits":2,"request":1691469978,"start":1691469979,"response":1691469979,"gate_counts":{"1q":1,"2q":1},"results_url":"/v0.3/jobs/7cc8ce51-2e57-4140-96ce-cf8bada0bf91/results"}
33+
34+
When `status` becomes `completed`, get the job results.
35+
36+
## Get Job Results:
37+
38+
```shell
39+
curl "https://api.ionq.co/v0.3/jobs/7cc8ce51-2e57-4140-96ce-cf8bada0bf91/results" \
40+
-H "Authorization: apiKey $IONQ_API_KEY"
41+
```
42+
43+
> {"0":0.500000000,"3":0.500000000}
File renamed without changes.
File renamed without changes.

curl/README.md

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)