Breaking Change - Resource API to Resources API (Deprecable)
Deployed Date: 4/10/24
The resource
API has been replaced with a new resources
(plural) API. The documentation has been updated accordingly with client-apis/resource-api
being renamed to client-apis/resources-api
. This new API allows a richer set of returned content in the future without any further breaking changes.
The old resource
API returned:
{
"item": {
// item data
},
"itemList": [
{
// item data
},
{
// item data
}
]
}
The new resources
API returns:
{
"item": {
"errors": [],
"data": {
// item data
}
}
"itemList": {
"errors": [],
"data": [
{
// item data
},
{
// item data
}
]
}
}
For errors, the resources
API still returns the same format:
{
"item": {
"errors": ["error message"]
}
"itemList": {
"errors": ["error message"]
}
}
This is a deprecable change, and the previous resource
API will still continue to work. This means resource.getResource
in the SDK for v1.0.0-alpha.2
and older still works as well. However, documentation for these have been removed in favor of the new resources
API. There are no immediate plans to remove the resource
function, but ample time will be provided if it’s decided to do so.
Migration path
If you were using the raw API, simply use /s/api/v1/resources
instead of /s/api/v1/resource
. The payload is unchanged.
If you were using the SDK, upgrade to v1.0.0-alpha.3
and replace resource.getResource
with resources.getResources
. The payload is unchanged.
You must now access the resource data off the data
property. On success there will always be an empty errors
array. data
will not exist if an error occurred loading the resource, and the errors
array will be populated with the appropriate error messages.