Skip to content

Commit 1176d6a

Browse files
committed
changes & updates
changed inline code for code block in authorization section removed requests body & responses changed placement of verification endpoint moved log & monitor endpoints to additinal operations section swapped sync & async run endpoints
1 parent 5698e84 commit 1176d6a

File tree

1 file changed

+53
-50
lines changed

1 file changed

+53
-50
lines changed

sources/api/getting-started.mdx

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -34,70 +34,60 @@ Before you can start using the API, check if you have all the necessary prerequi
3434

3535
You must authenticate all API requests presented on this page. You can authenticate using your API token:
3636

37-
`Authorization: Bearer YOUR_API_TOKEN`
37+
```http
38+
Authorization: Bearer YOUR_API_TOKEN
39+
```
3840

3941
You can find your API token in the Apify Console under **[Settings > Integrations](https://console.apify.com/settings/integrations)**.
4042

41-
## Basic workflow
42-
43-
A most common workflow involving Apify API consists of the following steps:
44-
45-
1. Running an Actor.
46-
1. Monitoring the status of a run.
47-
1. Retrieving the results.
48-
1. Retrieving log for troubleshooting purposes. - optional
49-
50-
### 1. Run an Actor
43+
### Verify your account
5144

52-
#### Asynchronously
45+
To check your API credentials or account details:
5346

5447
```http title="Endpoint"
55-
POST https://api.apify.com/v2/acts/{actorId}/runs
48+
GET https://api.apify.com/v2/users/me
5649
```
5750

58-
```json title="Request body"
59-
TODO
60-
```
51+
Expected response codes:
6152

62-
```json title="Response"
63-
TODO
64-
```
53+
* `200`
6554

66-
Expected response codes:
55+
## Basic workflow
6756

68-
* 201
57+
A most common workflow involving Apify API consists of the following steps:
58+
59+
1. Running an Actor.
60+
1. Retrieving the results.
61+
62+
### 1. Run an Actor
6963

7064
#### Synchronously
7165

72-
For shorter runs where you need immediate results:
66+
For shorter runs where you need immiediate results:
7367

7468
```http title="Endpoint"
7569
POST https://api.apify.com/v2/acts/{actorId}/run-sync
7670
```
7771

78-
The request body is the same as for asynchronous runs, but the response will include the complete results once the Actor finishes.
79-
8072
Expected response codes:
8173

82-
* 201
83-
* 400
84-
* 408
74+
* `201`
75+
* `400`
76+
* `408`
8577

86-
### 2. Monitor run status
78+
#### Asynchronously
8779

8880
```http title="Endpoint"
89-
GET https://api.apify.com/v2/actor-runs/:runId
81+
POST https://api.apify.com/v2/acts/{actorId}/runs
9082
```
9183

92-
``` json title="Response"
93-
TODO
94-
```
84+
The request body is the same as for asynchronous runs, but the response will include the complete results once the Actor finishes.
9585

96-
Expected response code:
86+
Expected response codes:
9787

98-
* 200
88+
* `201`
9989

100-
### 3. Retrieve results
90+
### 2. Retrieve results
10191

10292
#### From a Dataset
10393

@@ -121,7 +111,7 @@ Optional query parameters:
121111

122112
Expected code responses:
123113

124-
* 200
114+
* `200`
125115

126116
#### From a Key-value store
127117

@@ -131,10 +121,12 @@ GET https://api.apify.com/v2/key-value-stores/{storeId}/records/{recordKey}
131121

132122
Expected response codes:
133123

134-
* 200
135-
* 302
124+
* `200`
125+
* `302`
126+
127+
### Additional operations
136128

137-
### Get log
129+
#### Get log
138130

139131
You can get a log for a specific run or build of an Actor.
140132

@@ -144,35 +136,46 @@ GET https://api.apify.com/v2/logs/:buildOrRunId
144136

145137
Expected code responses:
146138

147-
* 200
139+
* `200`
148140

149-
### Additional operations
141+
#### Monitor run status
150142

151-
#### Store data in Key-value store
143+
```http title="Endpoint"
144+
GET https://api.apify.com/v2/actor-runs/:runId
145+
```
152146

153-
To store your own data in a Key-value store:
147+
Expected response code:
148+
149+
* `200`
150+
151+
#### Store data in Dataset
152+
153+
To store your own data in a Dataset:
154154

155155
```http title="Endpoint"
156-
PUT https://api.apify.com/v2/key-value-stores/{storeId}/records/{recordKey}
156+
POST https://api.apify.com/v2/datasets/:datasetId/items
157157
```
158158

159-
Include your data in the request body and set the appropriate `Content-Type` header.
159+
If any of the items received by the API fails the validation, whole request is discarded.
160160

161161
Expected response codes:
162162

163-
* 201
163+
* `201`
164+
* `400`
164165

165-
#### Verify your account
166+
#### Store data in Key-value store
166167

167-
To check your API credentials or account details:
168+
To store your own data in a Key-value store:
168169

169170
```http title="Endpoint"
170-
GET https://api.apify.com/v2/users/me
171+
PUT https://api.apify.com/v2/key-value-stores/{storeId}/records/{recordKey}
171172
```
172173

174+
Include your data in the request body and set the appropriate `Content-Type` header.
175+
173176
Expected response codes:
174177

175-
* 200
178+
* `201`
176179

177180
## Next steps
178181

0 commit comments

Comments
 (0)