-
Notifications
You must be signed in to change notification settings - Fork 91
docs: add missing actor-tasks endpoint #1510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -537,6 +537,8 @@ paths: | |
$ref: 'paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync.yaml' | ||
'/v2/actor-tasks/{actorTaskId}/run-sync-get-dataset-items': | ||
$ref: 'paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync-get-dataset-items.yaml' | ||
'/v2/actor-tasks/{actorTaskId}/runs/last': | ||
$ref: 'paths/actor-tasks/actor-tasks@{actorTaskId}@[email protected]' | ||
/v2/actor-runs: | ||
$ref: paths/actor-runs/actor-runs.yaml | ||
'/v2/actor-runs/{runId}': | ||
|
157 changes: 157 additions & 0 deletions
157
apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@[email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
get: | ||
tags: | ||
- Actor tasks | ||
summary: Get last run | ||
description: | | ||
This is not a single endpoint, but an entire group of endpoints that lets you to | ||
retrieve and manage the last run of given actor task or any of its default storages. | ||
All the endpoints require an authentication token. | ||
|
||
The endpoints accept the same HTTP methods and query parameters as | ||
the respective storage endpoints. | ||
The base path represents the last actor task run object is: | ||
|
||
`/v2/actor-tasks/{actorTaskId}/runs/last{?token,status}` | ||
|
||
Using the `status` query parameter you can ensure to only get a run with a certain status | ||
(e.g. `status=SUCCEEDED`). The output of this endpoint and other query parameters | ||
are the same as in the [Run object](/api/v2/actor-run-get) endpoint. | ||
|
||
In order to access the default storages of the last actor task run, i.e. log, key-value store, dataset and request queue, | ||
use the following endpoints: | ||
|
||
* `/v2/actor-tasks/{actorTaskId}/runs/last/log{?token,status}` | ||
* `/v2/actor-tasks/{actorTaskId}/runs/last/key-value-store{?token,status}` | ||
* `/v2/actor-tasks/{actorTaskId}/runs/last/dataset{?token,status}` | ||
* `/v2/actor-tasks/{actorTaskId}/runs/last/request-queue{?token,status}` | ||
|
||
These API endpoints have the same usage as the equivalent storage endpoints. | ||
For example, | ||
`/v2/actor-tasks/{actorTaskId}/runs/last/key-value-store` has the same HTTP method and parameters as the | ||
[Key-value store object](/api/v2/storage-key-value-stores) endpoint. | ||
|
||
Additionally, each of the above API endpoints supports all sub-endpoints | ||
of the original one: | ||
|
||
##### Storage endpoints | ||
|
||
* [Dataset - introduction](/api/v2/storage-datasets) | ||
|
||
* [Key-value store - introduction](/api/v2/storage-key-value-stores) | ||
|
||
* [Request queue - introduction](/api/v2/storage-request-queues) | ||
|
||
For example, to download data from a dataset of the last succeeded actor task run in XML format, | ||
send HTTP GET request to the following URL: | ||
|
||
``` | ||
https://api.apify.com/v2/actor-tasks/{actorTaskId}/runs/last/dataset/items?token={yourApiToken}&format=xml&status=SUCCEEDED | ||
``` | ||
|
||
In order to save new items to the dataset, send HTTP POST request with JSON payload to the same URL. | ||
operationId: actorTask_runs_last_get | ||
parameters: | ||
- name: actorTaskId | ||
in: path | ||
description: Task ID or a tilde-separated owner's username and Actor task name. | ||
required: true | ||
style: simple | ||
schema: | ||
type: string | ||
example: janedoe~my-task | ||
- name: status | ||
in: query | ||
description: Filter for the run status. | ||
style: form | ||
explode: true | ||
schema: | ||
type: string | ||
example: SUCCEEDED | ||
responses: | ||
'200': | ||
description: '' | ||
headers: {} | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
required: | ||
- data | ||
properties: | ||
data: | ||
$ref: "../../components/schemas/actor-runs/Run.yaml" | ||
example: | ||
data: | ||
id: HG7ML7M8z78YcAPEB | ||
actId: HDSasDasz78YcAPEB | ||
userId: 7sT5jcggjjA9fNcxF | ||
actorTaskId: KJHSKHausidyaJKHs | ||
startedAt: '2019-11-30T07:34:24.202Z' | ||
finishedAt: '2019-12-12T09:30:12.202Z' | ||
status: RUNNING | ||
statusMessage: Actor is running | ||
isStatusMessageTerminal: false | ||
meta: | ||
origin: WEB | ||
clientIp: 172.234.12.34 | ||
userAgent: Mozilla/5.0 (iPad) | ||
stats: | ||
inputBodyLen: 240 | ||
restartCount: 0 | ||
resurrectCount: 2 | ||
memAvgBytes: 267874071.9 | ||
memMaxBytes: 404713472 | ||
memCurrentBytes: 0 | ||
cpuAvgUsage: 33.75321011075384 | ||
cpuMaxUsage: 169.65073553494125 | ||
cpuCurrentUsage: 0 | ||
netRxBytes: 103508042 | ||
netTxBytes: 4854600 | ||
durationMillis: 248472 | ||
runTimeSecs: 248.472 | ||
metamorph: 0 | ||
computeUnits: 0.13804 | ||
options: | ||
build: latest | ||
timeoutSecs: 300 | ||
memoryMbytes: 1024 | ||
diskMbytes: 2048 | ||
buildId: 7sT5jcggjjA9fNcxF | ||
exitCode: 0 | ||
defaultKeyValueStoreId: eJNzqsbPiopwJcgGQ | ||
defaultDatasetId: wmKPijuyDnPZAPRMk | ||
defaultRequestQueueId: FL35cSF7jrxr3BY39 | ||
buildNumber: 0.0.36 | ||
containerUrl: 'https://g8kd8kbc5ge8.runs.apify.net' | ||
isContainerServerReady: true | ||
gitBranchName: master | ||
usage: | ||
ACTOR_COMPUTE_UNITS: 3 | ||
DATASET_READS: 4 | ||
DATASET_WRITES: 4 | ||
KEY_VALUE_STORE_READS: 5 | ||
KEY_VALUE_STORE_WRITES: 3 | ||
KEY_VALUE_STORE_LISTS: 5 | ||
REQUEST_QUEUE_READS: 2 | ||
REQUEST_QUEUE_WRITES: 1 | ||
DATA_TRANSFER_INTERNAL_GBYTES: 1 | ||
DATA_TRANSFER_EXTERNAL_GBYTES?: 3 | ||
PROXY_RESIDENTIAL_TRANSFER_GBYTES: 34 | ||
PROXY_SERPS: 3 | ||
usageTotalUsd: 0.2654 | ||
usageUsd: | ||
ACTOR_COMPUTE_UNITS: 0.072 | ||
DATASET_READS: 0.0004 | ||
DATASET_WRITES: 0.0002 | ||
KEY_VALUE_STORE_READS: 0.0006 | ||
KEY_VALUE_STORE_WRITES: 0.002 | ||
KEY_VALUE_STORE_LISTS: 0.004 | ||
REQUEST_QUEUE_READS: 0.005 | ||
REQUEST_QUEUE_WRITES: 0.02 | ||
DATA_TRANSFER_INTERNAL_GBYTES: 0.0004 | ||
DATA_TRANSFER_EXTERNAL_GBYTES?: 0.0002 | ||
PROXY_RESIDENTIAL_TRANSFER_GBYTES: 0.16 | ||
PROXY_SERPS: 0.0006 | ||
deprecated: false | ||
x-legacy-doc-urls: | ||
- https://docs.apify.com/api/v2#/reference/actor-tasks/last-run-object-and-its-storages |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not gonna lie, this is confusing. Can you spare the time to split this into four endpoints instead, each with their own documentation?
Of course, if that's something you want to pursue later, we can merge this as is - it sure is better than nothing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I fully agree. This is something that is next on TODO list, to split this and every other endpoint that is done this way into separate ones. This PR was meant to just reintroduce the missing endpoint so we have parity between old API Blueprint and current OpenAPI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, right. I trust you to track that somewhere 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken we have two like this already
Get last run
Get run
and this would be the third like that.