Skip to content

Commit 3dbfff5

Browse files
authored
docs(openapi): Document 404 related errors on acts and actor-builds endpoints (#2308)
## Summary - Create reusable error response schemas - Use granular 404 errors - Autogenerate 404 error response examples if possible (Done only for `acts` and `actor-builds` endpoints to limit the scope of the change. It should be done to all endpoints in follow-up PRs) ## Motivation - Preparation for adding undocumented redispatch endpoints, which will re-use the error schemas. - Properly document different 404 errors returnable by the endpoint. This will give the user a better idea about potential failures. Example of granular 404s for an endpoint that relies on multiple resources: <img width="3500" height="972" alt="image" src="https://github.com/user-attachments/assets/112757cb-183b-483e-8d15-34cfa14afda8" /> ## Issues Partially implements: #2286 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > <sup>[Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) is generating a summary for commit f16d5e5. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 4237e0a commit 3dbfff5

26 files changed

+359
-51
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
ActorNotFoundError:
2+
type: object
3+
properties:
4+
error:
5+
type: object
6+
properties:
7+
type:
8+
type: string
9+
enum: [actor-not-found]
10+
message:
11+
type: string
12+
example: Actor was not found
13+
14+
ActorBuildNotFoundError:
15+
type: object
16+
properties:
17+
error:
18+
type: object
19+
properties:
20+
type:
21+
type: string
22+
enum: [record-not-found]
23+
message:
24+
type: string
25+
example: Actor build was not found
26+
27+
ActorRunNotFoundError:
28+
type: object
29+
properties:
30+
error:
31+
type: object
32+
properties:
33+
type:
34+
type: string
35+
enum: [record-not-found]
36+
message:
37+
type: string
38+
example: Actor run was not found
39+
40+
ActorRunTimeoutExceededError:
41+
type: object
42+
properties:
43+
error:
44+
type: object
45+
properties:
46+
type:
47+
type: string
48+
enum: [run-timeout-exceeded]
49+
message:
50+
type: string
51+
example: Actor run exceeded the timeout of 300 seconds for this API endpoint
52+
53+
ActorRunFailedError:
54+
type: object
55+
properties:
56+
error:
57+
type: object
58+
properties:
59+
type:
60+
type: string
61+
enum: [run-failed]
62+
message:
63+
type: string
64+
example: "Actor run did not succeed (run ID: 55uatRrZib4xbZs, status: FAILED)"
65+
66+
ActorVersionNotFoundError:
67+
type: object
68+
properties:
69+
error:
70+
type: object
71+
properties:
72+
type:
73+
type: string
74+
enum: [record-not-found]
75+
message:
76+
type: string
77+
example: Actor version was not found
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
UnknownBuildTagError:
2+
type: object
3+
properties:
4+
error:
5+
type: object
6+
properties:
7+
type:
8+
type: string
9+
enum: [unknown-build-tag]
10+
message:
11+
type: string
12+
example: 'Build with tag "latest" was not found. Has the Actor been built already?'
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
EnvironmentVariableNotFoundError:
2+
type: object
3+
properties:
4+
error:
5+
type: object
6+
properties:
7+
type:
8+
type: string
9+
enum: [record-not-found]
10+
message:
11+
type: string
12+
example: Environment variable was not found

apify-api/openapi/paths/actor-builds/actor-builds@{buildId}.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ get:
5353
"403":
5454
$ref: ../../components/responses/Forbidden.yaml
5555
"404":
56-
$ref: ../../components/responses/NotFound.yaml
56+
description: Not found - the requested resource was not found.
57+
content:
58+
application/json:
59+
schema:
60+
$ref: "../../components/schemas/common/errors/ActorErrors.yaml#/ActorBuildNotFoundError"
5761
deprecated: false
5862
x-legacy-doc-urls:
5963
- https://docs.apify.com/api/v2#/reference/actor-builds/build-object/get-build
@@ -95,7 +99,11 @@ delete:
9599
"401":
96100
$ref: ../../components/responses/Unauthorized.yaml
97101
"404":
98-
$ref: ../../components/responses/NotFound.yaml
102+
description: Not found - the requested resource was not found.
103+
content:
104+
application/json:
105+
schema:
106+
$ref: "../../components/schemas/common/errors/ActorErrors.yaml#/ActorBuildNotFoundError"
99107
deprecated: false
100108
x-legacy-doc-urls:
101109
- https://docs.apify.com/api/v2#/reference/actor-builds/delete-build/delete-build

apify-api/openapi/paths/actor-builds/actor-builds@{buildId}@abort.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ post:
3333
$ref: ../../components/responses/Unauthorized.yaml
3434
"403":
3535
$ref: ../../components/responses/Forbidden.yaml
36+
"404":
37+
description: Not found - the requested resource was not found.
38+
content:
39+
application/json:
40+
schema:
41+
$ref: "../../components/schemas/common/errors/ActorErrors.yaml#/ActorBuildNotFoundError"
3642
deprecated: false
3743
x-legacy-doc-urls:
3844
- https://docs.apify.com/api/v2#/reference/actor-builds/abort-build/abort-build

apify-api/openapi/paths/actor-builds/actor-builds@{buildId}@log.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ get:
5555
"400":
5656
$ref: ../../components/responses/BadRequest.yaml
5757
"404":
58-
$ref: ../../components/responses/NotFound.yaml
58+
description: Not found - the requested resource was not found.
59+
content:
60+
application/json:
61+
schema:
62+
$ref: "../../components/schemas/common/errors/ActorErrors.yaml#/ActorBuildNotFoundError"
5963
deprecated: false
6064
x-legacy-doc-urls:
6165
- https://docs.apify.com/api/v2#/reference/actor-builds/build-log/get-log

apify-api/openapi/paths/actor-builds/actor-builds@{buildId}@openapi.json.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ get:
3939
"400":
4040
$ref: ../../components/responses/BadRequest.yaml
4141
"404":
42-
$ref: ../../components/responses/NotFound.yaml
42+
description: Not found - the requested resource was not found.
43+
content:
44+
application/json:
45+
schema:
46+
$ref: "../../components/schemas/common/errors/ActorErrors.yaml#/ActorBuildNotFoundError"
4347
x-js-parent: BuildClient
4448
x-js-name: getOpenApiDefinition
4549
x-js-doc-url: https://docs.apify.com/api/client/js/reference/class/BuildClient#getOpenApiDefinition

apify-api/openapi/paths/actors/acts@{actorId}.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ get:
8383
finishedAt: "2019-06-10T11:15:49.286Z"
8484
"400":
8585
$ref: ../../components/responses/BadRequest.yaml
86+
"404":
87+
description: Not found - the requested resource was not found.
88+
content:
89+
application/json:
90+
schema:
91+
$ref: "../../components/schemas/common/errors/ActorErrors.yaml#/ActorNotFoundError"
8692
deprecated: false
8793
x-legacy-doc-urls:
8894
- https://docs.apify.com/api/v2#/reference/actors/actor-object/get-actor
@@ -264,6 +270,12 @@ put:
264270
finishedAt: "2019-06-10T11:15:49.286Z"
265271
"400":
266272
$ref: ../../components/responses/BadRequest.yaml
273+
"404":
274+
description: Not found - the requested resource was not found.
275+
content:
276+
application/json:
277+
schema:
278+
$ref: "../../components/schemas/common/errors/ActorErrors.yaml#/ActorNotFoundError"
267279
deprecated: false
268280
x-legacy-doc-urls:
269281
- https://docs.apify.com/api/v2#/reference/actors/actor-object/update-actor
@@ -302,6 +314,12 @@ delete:
302314
example: {}
303315
"400":
304316
$ref: ../../components/responses/BadRequest.yaml
317+
"404":
318+
description: Not found - the requested resource was not found.
319+
content:
320+
application/json:
321+
schema:
322+
$ref: "../../components/schemas/common/errors/ActorErrors.yaml#/ActorNotFoundError"
305323
deprecated: false
306324
x-legacy-doc-urls:
307325
- https://docs.apify.com/api/v2#/reference/actors/actor-object/delete-actor

apify-api/openapi/paths/actors/acts@{actorId}@builds.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ get:
6363
$ref: ../../components/schemas/actor-builds/ListOfBuildsResponse.yaml
6464
"400":
6565
$ref: ../../components/responses/BadRequest.yaml
66+
"404":
67+
description: Not found - the requested resource was not found.
68+
content:
69+
application/json:
70+
schema:
71+
$ref: "../../components/schemas/common/errors/ActorErrors.yaml#/ActorNotFoundError"
6672
deprecated: false
6773
x-legacy-doc-urls:
6874
- https://docs.apify.com/api/v2#/reference/actors/build-collection/get-list-of-builds
@@ -161,6 +167,12 @@ post:
161167
$ref: ../../components/schemas/actor-builds/BuildResponse.yaml
162168
"400":
163169
$ref: ../../components/responses/BadRequest.yaml
170+
"404":
171+
description: Not found - the requested resource was not found.
172+
content:
173+
application/json:
174+
schema:
175+
$ref: "../../components/schemas/common/errors/ActorErrors.yaml#/ActorNotFoundError"
164176
deprecated: false
165177
x-legacy-doc-urls:
166178
- https://docs.apify.com/api/v2#/reference/actors/build-collection/build-actor

apify-api/openapi/paths/actors/acts@{actorId}@builds@default.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ get:
4545
$ref: ../../components/schemas/actor-builds/BuildResponse.yaml
4646
"400":
4747
$ref: ../../components/responses/BadRequest.yaml
48+
"404":
49+
description: Not found - the requested resource was not found.
50+
content:
51+
application/json:
52+
schema:
53+
$ref: "../../components/schemas/common/errors/ActorErrors.yaml#/ActorNotFoundError"
54+
"403":
55+
# It should be 404, but is 403 for backwards compatibility. https://github.com/apify/apify-core/pull/17414
56+
description: Not found - the requested resource was not found.
57+
content:
58+
application/json:
59+
schema:
60+
$ref: "../../components/schemas/common/errors/BuildErrors.yaml#/UnknownBuildTagError"
4861
x-js-parent: ActorClient
4962
x-js-name: defaultBuild
5063
x-js-doc-url: https://docs.apify.com/api/client/js/reference/class/ActorClient#defaultBuild

0 commit comments

Comments
 (0)