use the 202 status consistently in triggering endpoints #2224
Conversation
… scheduling) and provide follow-up URLs in the response Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…ished (just like get_forecast) - for now only use this (over the old 400 code) if API_SUNSET is being used Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…ering-and-fetching-endpoints Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…ering-and-fetching-endpoints Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Documentation build overview
28 files changed ·
|
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…ering-and-fetching-endpoints
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
|
|
||
| { | ||
| "status": "ACCEPTED", | ||
| "job_id": "364bfd06-c1fa-430b-8d25-8f5a547651fb", |
There was a problem hiding this comment.
Rationale: API policy specifies no id in API keys.
| "job_id": "364bfd06-c1fa-430b-8d25-8f5a547651fb", | |
| "job": "364bfd06-c1fa-430b-8d25-8f5a547651fb", |
| { | ||
| "status": "ACCEPTED", | ||
| "job_id": "364bfd06-c1fa-430b-8d25-8f5a547651fb", | ||
| "job_monitor_url": "/api/v3_0/jobs/364bfd06-c1fa-430b-8d25-8f5a547651fb", |
There was a problem hiding this comment.
Rationale:
- API policy specifies kebab-case keys in API
- (to discuss) Not just for progress monitoring; (some) results live there, too. Do we want to keep two endpoints? Right now we have one for the schedule, and the other for job progress and constraints analysis, and I am at least planning to also let it contain the core result (schedule, forecast, report).
| "job_monitor_url": "/api/v3_0/jobs/364bfd06-c1fa-430b-8d25-8f5a547651fb", | |
| "job-url": "/api/v3_0/jobs/364bfd06-c1fa-430b-8d25-8f5a547651fb", |
There was a problem hiding this comment.
Do we want to keep two endpoints?
Are you suggesting to deprecate GET /api/v3_0/sensors/{id}/schedules/{uuid} and GET /api/v3_0/sensors/{id}/forecasts/{uuid}
I believe that could make things easier. Less endpoints to learn for users, for us to maintain.
Once, we discussed making a REST-like resource for scheduling jobs, forecasting jobs (and now possibly also reporting jobs). I don't think we want to really go there anymore. Triggering does live on asset and sensor resources, though. I am curious where reporting triggers will live.
Anyway, with that discussion we're moving out of the scope of this PR here.
For here, I am fine to (already) work with results-url, as you suggest below, next to job-url. One of them could be retired later, but I don't know which right now.
| v1.0.0 | July XX, 2026 | ||
| ============================ | ||
|
|
||
| .. warning:: As of this release we standardize asynchronous job responses to use the `job_id` field and return HTTP `202 Accepted` when a background job is queued. Legacy response fields such as ``schedule`` and ``forecast`` will be deprecated; clients should migrate to `job_id` (see the Infrastructure / Support section below for migration details). |
There was a problem hiding this comment.
The cross-reference is just throwing up another curtain. You have to find the section below, then read it to notice it has almost nothing to add, then follow up on the reference there to actually find more info.
Better would be to directly cross-reference some material that is actionable to clients, rather than an issue or PR. In addition, that material might reference the new docs on deprecation notices in responses.
…camel-case - even in existing job status endpoitn fields (using the new field-deprecation logic) Signed-off-by: Nicolas Höning <nicolas@seita.nl>
…ering-and-fetching-endpoints Signed-off-by: Nicolas Höning <nicolas@seita.nl>
Description
Use 202 in triggering endoints (forecasting scheduling) and provide follow-up URLs in the response.
Closes #2171
job_idas the canonical response field while keeping legacyschedule/forecastfields for compatibility._deprecated_fieldsmetadata, to deprecate fields in endpoints, and forschedule/forecastfields, employ it withuse: "job_id"anddeprecated_since: "1.0.0".request_accepted_for_processing(...)so accepted job responses can include legacy keys and result URLs.Look & Feel
Mainly Sphinx and Swaggerdocs.
How to test
The only new test is
test_get_schedule_unfinished_job_returns_202_when_sunset_active.A bunch of tests simply check for 202 now instead of 200.