Skip to main content

Resources API Request and Response

Authentication

The Resources API requires authentication for all requests. For detailed information about authentication methods and requirements, please see the Authentication section of the API documentation.

Required Headers

All requests to the Resources API must include the following headers:

HeaderDescriptionRequiredExample
X-Spaaza-Chain-IDNumeric Chain ID for the requestYes1743
X-Spaaza-API-versionAPI version (minimum 1.6.1)Yes1.6.1
X-Spaaza-Session-User-IDUser ID for authenticationYes{your user ID}
X-Spaaza-Session-KeySession key for authenticationYes{your key}
X-Spaaza-Response-Recursion-LevelResponse detail level (0-4, default 3)Optional3
Content-TypeContent type for POST/PATCH/PUT requestsFor POST/PATCHapplication/json

Responses

Resources API endpoints return payloads in JSON format as follows:

  • Single Resource Retrieval: Returns a JSON object representing the resource in accordance with the OpenAPI specification of the resource.
  • Multiple Resource Retrieval: Returns a JSON object containing an array of resources along with pagination metadata.

For more detailed information about API response formats, status codes, and data structures, please see the Responses section of the API documentation.

Response Recursion Levels

The Resources API supports configurable response detail levels through the X-Spaaza-Response-Recursion-Level header. This controls how much detail is included in API responses, particularly for nested objects and relationships.

Recursion Level Values

  • Level 0: Minimal response with only basic identifiers
  • Level 1: Basic properties without nested objects
  • Level 2: Includes some nested object properties
  • Level 3: Default level with comprehensive property details
  • Level 4: Maximum detail including all available properties

Usage

Include the X-Spaaza-Response-Recursion-Level header in your requests to specify the desired detail level:

curl -X GET https://{API hostname}/resources/{resource name}/{id} \
-H "X-Spaaza-Response-Recursion-Level: 2" \
# ... other headers

Note that, in the case of nested resources, the recursion level applies recursively to related resources as well and the remaining recursion level value is "carried" down the object tree. For example, if you request recursion level 3 for a resource, Resource 1, and a nested resource in Resource 1 has a recursion level of 2, then that nested resource will be returned with recursion level of (3 - 2 = 1).

If not specified, the default recursion level of 3 is used.

Versioning

For information about API versioning and version compatibility, please see the Versioning section of the API documentation.

Possible Error Responses

The following error codes are specific to or commonly returned by the Resources API. Errors are listed in ascending order by code number.

Resources API-specific errors

These errors are unique to the Resources API:

CodeNameHTTP StatusDescription
533missing_parameter400A required parameter or header is missing (for example a missing X-Spaaza-Chain-ID header).
534invalid_parameter400A parameter is invalid, such as an incorrect Content-Type, an invalid JSON body, or an unrecognised filter.
539unknown_resource_type400The resource type in the URL path is not recognised.
540resource_type_not_properly_configured400The requested resource type is not properly configured on the server.
541resource_already_exists400A POST request attempted to create a resource that already exists (matched by identifier).
542schema_error400An error occurred while generating or processing the OpenAPI schema.
543parameter_validation_error400One or more parameters failed validation against the OpenAPI schema, or pagination/sort values are out of range.
544resource_not_found404The requested resource was not found, or the authenticated user does not have permission to access it.
545invalid_endpoint400The endpoint path or method is invalid (for example, the API version is below 1.6.1 or the HTTP method is not supported for this path).

General errors applicable to the Resources API

These errors are shared across the Spaaza API and may also be returned by the Resources API:

CodeNameHTTP StatusDescription
6no_valid_session401Authentication is missing or the session is not valid.
68permission_denied_or_non_existent403The authenticated user does not have sufficient permissions for the requested chain or resource.
408saving_object_error400An error occurred while saving the resource. The request may contain data that cannot be persisted.
419parameter_invalid400A parameter value is in an incorrect format (for example, text search or geospatial parameters).
424access_denied403Access to the requested chain or resource is denied for this user.
462parameter_mismatch400Identifier parameters in a PATCH or PUT request resolve to a different resource than the one being updated.

For a complete list of all error codes across the Spaaza API, please see the Error and Warning Codes page.