Skip to main content

Resources API Fundamentals

Overview

The Resources API provides a standardised way to interact with Spaaza resources using RESTful principles. Each resource supports standard HTTP methods (GET, POST, PATCH, PUT, DELETE) and follows OpenAPI specifications for consistent request and response formats.

The API is built around the concept of resources with properties that can be filtered, sorted, and paginated. Each resource includes OpenAPI annotations that define validation rules, data types, and custom Spaaza-specific attributes.

Available Resources

The Resources API currently supports the following resources:

  • Business - Represents a physical store location that is part of a retailer's chain. Includes location information, contact details, operational settings, and chain association.
  • Campaign - Represents a promotional campaign within the Spaaza platform. Currently supports change log retrieval for audit purposes.
  • Voucher - Represents a digital entitlement redeemable for discounts or rewards. Supports multiple types including basket vouchers, percentage vouchers, and honour vouchers with comprehensive status tracking.

Available Paths

The Resources API supports the following general endpoint patterns for resources:

Single Resource Operations

  • GET /resources/{resource name}/{id} - Retrieve a single resource by ID
  • GET /resources/{resource name}?{identifier parameter}={value} - Retrieve a single resource by identifier parameter
  • POST /resources/{resource name} - Create a new resource
  • PATCH /resources/{resource name}?{identifier parameter}={value} - Update an existing resource (by identifier parameter)
  • PATCH /resources/{resource name}/{id} - Update an existing resource (by ID)
  • PUT /resources/{resource name}?{identifier parameter}={value} - Update an existing resource (by identifier parameter)
  • PUT /resources/{resource name}/{id} - Update an existing resource (by ID)
  • DELETE /resources/{resource name}?{identifier parameter}={value} - Delete a resource (by identifier parameter)
  • DELETE /resources/{resource name}/{id} - Delete a resource (by ID)

Single resource operations return a JSON object results containing the resource object in accordance with the OpenAPI specification of the resource.

Multiple Resource Operations

  • GET /resources/{plural resource name} - Retrieve a list of resources with optional filtering and pagination

Multiple resource operations return a JSON object results containing an array of resources along with pagination metadata:

  • resources - Array of resource objects
  • limit - Maximum number of results returned
  • offset - Starting position of results returned
  • total_count - Total number of matching resources available
  • result_type - Type of resources returned (plural)

Schema Endpoint

  • GET /resources/schema - Retrieve the complete OpenAPI schema for all resources (see Schema Endpoint below for details)