Skip to main content
Was this helpful?

Resource API

Resource Catalog

Manage resource types, resources, color settings, and public booking tokens

This page covers the authenticated resource surface: the reusable resource-type catalog and the concrete resources that can be reserved or published for booking.

JWT or user API keyResource typesPublic booking tokensDeletion previews

Source

  • Resources controller: backend-nestjs/src/resources/resources.controller.ts
  • Resource types controller: backend-nestjs/src/resource-types/resource-types.controller.ts
  • DTOs: backend-nestjs/src/dto/resource.dto.ts, backend-nestjs/src/dto/resource-type.dto.ts, backend-nestjs/src/resources/dto/resource.query.dto.ts, backend-nestjs/src/resource-types/dto/resource-type.query.dto.ts, backend-nestjs/src/resource-types/dto/update-resource-type-color.dto.ts

Authentication and Permissions

  • All routes on this page require authentication.
  • Results are filtered to the resources and organizations the current user can access.
  • Token and cascade operations rely on the resource access checks in the service and guard layers.

Endpoint Reference

Resource Types

MethodPathPurposeRequest or queryAuthSource
POST/api/resource-typesCreate a resource type.Body: type fieldsJWT or user API keyresource-types/resource-types.controller.ts
GET/api/resource-typesList resource types.Query: organisationIdJWT or user API keyresource-types/resource-types.controller.ts
GET/api/resource-types/:idGet one resource type.Path: idJWT or user API keyresource-types/resource-types.controller.ts
PATCH/api/resource-types/:idUpdate a resource type.Path: id, body: partial type fieldsJWT or user API keyresource-types/resource-types.controller.ts
DELETE/api/resource-types/:idDelete a resource type.Path: idJWT or user API keyresource-types/resource-types.controller.ts
GET/api/resource-types/:id/deletion-previewPreview deletion impact for a resource type.Path: idJWT or user API keyresource-types/resource-types.controller.ts
DELETE/api/resource-types/:id/cascadeCascade-delete a resource type and dependents.Path: idJWT or user API keyresource-types/resource-types.controller.ts
PATCH/api/resource-types/:id/colorUpdate only the resource-type color.Path: id, body: colorJWT or user API keyresource-types/resource-types.controller.ts

Resources

MethodPathPurposeRequest or queryAuthSource
POST/api/resourcesCreate a resource.Body: name,description,capacity,resourceTypeId,managedByIdJWT or user API keyresources/resources.controller.ts
GET/api/resourcesList resources.Query: resourceTypeIdJWT or user API keyresources/resources.controller.ts
GET/api/resources/:idGet one resource.Path: idJWT or user API keyresources/resources.controller.ts
PATCH/api/resources/:idUpdate a resource.Path: id, body: partial resource fieldsJWT or user API keyresources/resources.controller.ts
DELETE/api/resources/:idDelete a resource.Path: idJWT or user API keyresources/resources.controller.ts
GET/api/resources/:id/deletion-previewPreview deletion impact for a resource.Path: idJWT or user API keyresources/resources.controller.ts
DELETE/api/resources/:id/cascadeCascade-delete a resource and dependents.Path: idJWT or user API keyresources/resources.controller.ts
GET/api/resources/:id/public-tokenRead the public booking token.Path: idJWT or user API keyresources/resources.controller.ts
POST/api/resources/:id/regenerate-tokenRegenerate the public booking token.Path: idJWT or user API keyresources/resources.controller.ts

Request Shapes

Resource types

CreateResourceTypeDto and UpdateResourceTypeDto

  • name: required on create
  • description: optional string
  • minBookingDuration: optional int, minimum 1
  • bufferTime: optional int, minimum 0
  • customerInfoFields: optional string array
  • waitlistEnabled: optional boolean
  • recurringEnabled: optional boolean
  • color: optional string
  • icon: optional string
  • organisationId: required on create
  • isActive: update-only optional boolean

Queries and focused updates:

  • ResourceTypeListQueryDto.organisationId: optional int >= 1
  • UpdateResourceTypeColorDto.color: required color string

Resources

CreateResourceDto and UpdateResourceDto

  • name: required on create
  • description: optional string
  • capacity: optional int, minimum 1
  • resourceTypeId: required on create
  • managedById: optional int
  • isActive: update-only optional boolean

Queries:

  • ResourceListQueryDto.resourceTypeId: optional int >= 1

Example Calls

Create a resource type

curl -X POST "$PRIMECAL_API/api/resource-types" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Meeting Room",
"organisationId": 12,
"minBookingDuration": 30,
"bufferTime": 15,
"color": "#0ea5e9"
}'

Create a resource

curl -X POST "$PRIMECAL_API/api/resources" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Family Car",
"resourceTypeId": 3,
"capacity": 5
}'

Regenerate a public booking token

curl -X POST "$PRIMECAL_API/api/resources/21/regenerate-token" \
-H "Authorization: Bearer $TOKEN"

Response and Behavior Notes

  • Public-token routes can return both the raw token and a frontend-friendly booking URL.
  • Color cascade behavior exists at the organization layer and color-only updates exist at the resource-type layer.
  • Both resource and resource-type deletion-preview routes should be used before cascade deletion in admin-style UIs.

Best Practices

  • Create the resource type before creating resources that depend on it.
  • Treat token regeneration as destructive for any previously shared public links.
  • Keep resource-type configuration stable and use resource records for the frequently changing real-world inventory.
  • Use deletion previews before any cascade operation that might affect live reservations.