You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/migration.md
+45-27Lines changed: 45 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,30 +7,64 @@ largely functioning the same way. However, there are a few major deviations:
7
7
* Restriction or expansion of input types as appropriate.
8
8
* Standardizing authentication and access messages, and consistently execute those checks
9
9
before fetching data or providing error messages about the data.
10
+
* Errors are returned in the [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457.html) standard, and HTTP status codes may be changed to be more semantically appropriate.
10
11
11
12
The list above is not exhaustive. Minor changes include, for example, bug fixes and the removal of unnecessary nesting.
12
13
There may be undocumented changes, especially in edge cases which may not have occurred in the test environment.
13
14
As the PHP API was underspecified, the re-implementation is based on a mix of reading old code and probing the API.
14
-
If there is a behavioral change which was not documented but affects you, please [open a bug report](https://github.com/openml/server-api/issues/new?assignees=&labels=bug%2C+triage&projects=&template=bug-report.md&title=).
15
+
If there is a behavioral change which was not documented but affects you, please [open a bug report](https://github.com/openml/server-api/issues/new?assignees=&labels=bug%2C+triage&projects=&template=bug-report.md&title=). Also feel free to open an issue on the issue tracker if you feel that we made a mistake with a decision on e.g., a new status code.
15
16
16
17
It is possible this migration guide is out of sync for endpoints not yet deployed to production (currently that includes them all).
17
18
Before an endpoint is deployed to production we will ensure that the documentation is up-to-date to the best of our knowledge.
18
19
19
-
## All Endpoints
20
-
The following changes affect all endpoints.
20
+
# RFC 9457 Errors
21
+
Errors will follow the RFC9457 standard. However, the original "code" is preserved through a custom field.
22
+
Take for example the "Dataset not found" response for trying to access a dataset that does not exist.
21
23
22
-
### Error on Invalid Input
23
-
When providing input of invalid types (e.g., a non-integer dataset id) the HTTP header
+ {"type":"https://openml.org/problems/dataset-not-found","title":"Dataset Not Found","status":404,"detail":"No dataset with id 100000 found.","code":"111"}
33
+
```
34
+
35
+
You will notice that the response still contains a "code" of "111" (though as a top level property not embedded in the "error" scope).
36
+
This field is included to support the migration of clients, but should be considered deprecated.
37
+
As per the RFC9457 standard, the "type" field now includes the unique code for the error.
38
+
The "title" field is a human readable summary of the general issue and the "detail" field may provide additional information for the specific request.
39
+
They _will_ be resolvable URIs in the future, providing a page with more information.
40
+
41
+
In some cases the JSON endpoints previously returned XML ([example](https://github.com/openml/OpenML/issues/1200)), the new API always returns JSON.
42
+
43
+
# Appropriate HTTP Status Codes
44
+
There are several cases where the PHP server did not provide semantically correct status codes.
45
+
The Python server aims to correct that.
46
+
The errors that changed which are most likely to occur are probably errors when there is no result, or when the input is incorrect.
47
+
48
+
49
+
For not being able to resolve an identifier ("dataset not found"):
25
50
26
51
```diff title="HTTP Header"
27
52
- 412 Precondition Failed
28
-
+ 422 Unprocessable Entity
53
+
+ 404 Not Found
54
+
```
55
+
56
+
When authentication is required but not provided or not valid:
57
+
58
+
```diff title="HTTP Header"
59
+
- 412 Precondition Failed
60
+
+ 401 Unauthorized
29
61
```
30
62
31
-
```diff title="JSON Content"
32
-
- {"error":{"code":"100","message":"Function not valid"}}
33
-
+ {"detail":[{"loc":["query","_dataset_id"],"msg":"value is not a valid integer","type":"type_error.integer"}]}
63
+
For incorrect input (e.g., providing a string instead of an integer identifier):
64
+
65
+
```diff title="HTTP Header"
66
+
- 412 Precondition Failed
67
+
+ 422 Unprocessable Entity
34
68
```
35
69
36
70
!!! warning "Input validation has been added to many end points"
@@ -39,23 +73,7 @@ and JSON content will be different.
39
73
These endpoints now do enforce stricter input constraints.
40
74
Constraints for each endpoint parameter are documented in the API docs.
41
75
42
-
### Other Errors
43
-
For any other error messages, the response is identical except that outer field will be `"detail"` instead of `"error"`:
In some cases the JSON endpoints previously returned XML ([example](https://github.com/openml/OpenML/issues/1200)), the new API always returns JSON.
0 commit comments