feat: add Actor task publication endpoints - #2840
Conversation
|
✅ Preview for this PR (commit |
|
Important Action required — @Janjiran please coordinate this docs PR with the Python API client PR linked below. Because this PR modifies the OpenAPI specification, the generated models in A companion PR has been opened in
|
janbuchar
left a comment
There was a problem hiding this comment.
This looks legit as far as openapi semantics are considered
fnesveda
left a comment
There was a problem hiding this comment.
Is the API final? Why is it so different from the Actor publication API?
For example:
- Actors are published through the "update Actor" endpoint, tasks have special
/publishand/unpublishendpoints - Actors have
isPublic, tasks havepublishedAt - Actors have a
categoriesarray, tasks havecategorizationstring - Actors have all the details (
seoTitleetc.) on the top level, tasks have it inpublicConfig
Can we unify the API so that it's the same as for Actors?
Also, property names like inputSchemaFields, datasetName and datasetView somehow don't capture that they're being used only when showing the task, but they sound like they're relevant to the whole task (e.g. that they limit what input fields can the task process). How about putting them under some displayOptions object?
Also CC @gippy - would you look at this through the lens of the rules for API endpoints you wrote? 🙏
Task create now documents `publicConfig` (the API accepts the display fields and ignores the server-controlled `publishedAt`/`renderableAt`), and the update schema no longer offers a null the API rejects. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
We already discussed this. The 3 points:
Already exist in the current console backend API, so changing them would require migration and complete rewrite. I already shared my opinion on this when it was going to be impelemented in console backend, but now that train has left the station. So for API I proposed the option to have the Since publishing does multiple verification steps, not just for the task detail but also for Actor permission and the Actor "readyness" for task publication it kinda makes sense. Alternatives are either:
From my point of view I think it's ok to not have it match, the logic on Actor is not great either with the Actor update endpoint having 9 dependencies and over 400+ lines of code in the |
I really don't agree with this. We can't shape the public API around our internal implementation, we need to make a good public API and then make the implementation work with it. Writing a migration is a one time pain (and I believe this one can be done through Claude pretty well). A bad API stays with us forever.
On their own, these are good, and I agree we should have done the Actors API this way, but that train has surely left the station. So now that we have the Actors API done like this, let's try to have the tasks API consistent with it. |
Isn't that exactly what we're trying to do here though? To make a good public API and then make the implementation work with it, instead of shaping the new API around the Actor publication design, which you agree is the worse one. So we are designing the tasks API the way we think a good API should look. I get the consistency point, but if a bad API stays with us forever, then requiring every new API to copy the old pattern is exactly how it stays forever. By following the latest API conventions @gippy put together, the The schema differences ( |
I get your point, and in isolation, the
Requiring every new API to copy the old pattern is how we prevent a bad API in the first place - an inconsistent API is a bad API. If we decide "later we can add the same endpoints to Actors", realistically, we'll never do it, because we'll always have better things to do than changing an ancient, heavily integrated, slightly bad API flow. (I've had my technical purist heart broken many times by the reality of prioritization with limited capacity 🥲) |
Replaces the dedicated publish/unpublish endpoints with a virtual `isPublic` field on the task update, matching how Actors are published. `isPublic` is also returned on the task, derived from `publicConfig.publishedAt`. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Based on the discussion above, we've agreed to change the API to match the Actors:
|
|
I like the |
katzino
left a comment
There was a problem hiding this comment.
LGTM ✅
Had some factual comments, feel free to skip those that doesn't make sense to you. Maybe someone from the content team could help us to formulate it properly.
| - $ref: ../actors/ActorStandby.yaml | ||
| - type: "null" | ||
| publicConfig: | ||
| description: | |
There was a problem hiding this comment.
I'd go with something like this:
Configuration that controls how the published task appears on its public landing page. Editing this object requires write permission to the Actor that the task belongs to.
We don't need to include info on what not to do here, the publication process should be explained in the endpoint description and the relevant field.
| format: uri | ||
| isPublic: | ||
| type: boolean | ||
| description: | |
There was a problem hiding this comment.
Fluffy :D I'd go with:
Whether the task is published. Based on the 'publicConfig.publishedAt' field.
The rest of the description seems to belong to the endpoint description, not the field.
| format: date-time | ||
| readOnly: true | ||
| description: | | ||
| Time when the task was published, or `null` if the task is not published. |
There was a problem hiding this comment.
| Time when the task was published, or `null` if the task is not published. | |
| Time when the task was published, or `null` if the task isn't published. |
| readOnly: true | ||
| description: | | ||
| Time when the task was published, or `null` if the task is not published. | ||
| This field is server-controlled - to publish or unpublish a task, set `isPublic` |
There was a problem hiding this comment.
Shorter sentences improve readability, I'd go with:
This field is server-controlled. To publish or unpublish a task, use the [Update task](/api/v2/actor-task-put) endpoint and set 'isPublic'.
| examples: ["2025-06-16T09:20:45.777Z"] | ||
| seoTitle: | ||
| type: [string, "null"] | ||
| description: SEO title of the public task page. Defaults to the task title when not set. |
There was a problem hiding this comment.
| description: SEO title of the public task page. Defaults to the task title when not set. | |
| description: Name of the Actor task to display by search engines such as Google. Defaults to the task title. |
Worth adding character limit or similar things.
| examples: [Scrape data from a website] | ||
| seoDescription: | ||
| type: [string, "null"] | ||
| description: SEO description of the public task page. Defaults to the task description when not set. |
There was a problem hiding this comment.
| description: SEO description of the public task page. Defaults to the task description when not set. | |
| description: Description of the Actor task to display by search engines such as Google. Defaults to the task description. |
| description: SEO description of the public task page. Defaults to the task description when not set. | ||
| categorization: | ||
| type: [string, "null"] | ||
| description: Use-case category of the public task. |
There was a problem hiding this comment.
| description: Use-case category of the public task. | |
| description: Category that best defines the use case of the task. |
| type: [string, "null"] | ||
| description: | | ||
| Name of the dataset from the Actor's dataset schema whose results are displayed. When | ||
| `null`, the Actor's default dataset is used - the only dataset it declares, or the one |
There was a problem hiding this comment.
| `null`, the Actor's default dataset is used - the only dataset it declares, or the one | |
| `null`, the Actor's default dataset is used. That is, the only dataset the Actor declares, or the one |
| type: [string, "null"] | ||
| description: | | ||
| Key of the dataset view from the Actor's dataset schema used to display results. Must be | ||
| one of the views declared on the resolved dataset; a task cannot be published without it. |
There was a problem hiding this comment.
| one of the views declared on the resolved dataset; a task cannot be published without it. | |
| one of the views declared on the resolved dataset. You can't publish a task without it. |
| description: | | ||
| Public-facing display configuration of the task's public landing page. The provided | ||
| fields are merged into the stored configuration and validated. The stored configuration | ||
| cannot be cleared this way. Set `isPublic` to change the publication state. |
There was a problem hiding this comment.
How to clear the stored configuration then?
fnesveda
left a comment
There was a problem hiding this comment.
I see some of the things I've raised in the previous review are still here, and still different from Actors:
- Actors have a
categoriesarray, tasks havecategorizationstring- Actors have all the details (
seoTitleetc.) on the top level, tasks have it inpublicConfigAlso, property names like
inputSchemaFields,datasetNameanddatasetViewsomehow don't capture that they're being used only when showing the task, but they sound like they're relevant to the whole task (e.g. that they limit what input fields can the task process). How about putting them under somedisplayOptionsobject?
Have you discussed them already, and if so, what was the verdict? The response shape is also a part of the public API, so we need to have it finalized before merging this.
Part of https://github.com/apify/apify-core/issues/29471
Adding new public endpoint for Actor Task publication API.
Blocked by https://github.com/apify/apify-core/pull/29623