Skip to main content

Rest API

Seatsurfing provides and uses a couple of REST APIs. The REST APIs are used by the mobile and web app as well as the administrator web interface.

Authorization checks

Each API function is protected by authorization checks:

  • First check: Role of the user (anonymous, user, org admin, super admin)
  • Second check: Organisation membership

Status Codes

Seatsurfing's REST API uses the well known HTTP status codes to inform the caller about the result and eventual errors:

  • 201 Created: Object created (includes HTTP response header X-Object-ID)
  • 204 No Content: Object updated or no response content
  • 400 Bad Request: Malformed request or incomplete JSON
  • 401 Unauthorized: JWT in HTTP request header Authorization missing, expired or invalid
  • 403 Forbidden: Authorized, by user has no access to requested resource
  • 404 Not found: Object not found
  • 409 Conflict: Conflicting request
  • 500 Internal Server Error

Roles

  • Anonymous: Every user allowed, no authorization required
  • User: Authorized user who is a member of an organisation
  • Org Admin: An organisation's administrator
  • Super Admin: Global administrator with access to all organisations and all functions

Endpoints

Authentication

Function EndpointMethodAnonymous User Org Admin Super Admin
Password Login/auth/loginPOSTX
Preflight Login to check for available login methods/auth/preflightPOSTX
Perform OAuth Login/auth/{id}/login/{type}GETX
OAuth Callback (server to server)/auth/{id}/callbackGETX
Retrieve JWT from frontend / app after OAuth Login/auth/verify/{id}GETX
Check if instance hosts one organization only/auth/singleorgGETX

Bookings

Function EndpointMethodAnonymous User Org Admin Super Admin
Get one own booking/booking/{id}GETX
Update one own booking/booking/{id}PUTX
Delete one own booking/booking/{id}DELETEX
Create new own booking/booking/POSTX
Create new booking for others/booking/POSTX
Get user's own upcoming bookings/booking/GETX
Get filtered org bookings/booking/filter/POSTX

Locations

Function EndpointMethodAnonymous User Org Admin Super Admin
Get one location/location/{id}GETX
Update one location/location/{id}PUTX
Delete one location/location/{id}DELETEX
Get all organization's location/location/GETX
Create a new location/location/POSTX
Get location map/location/{id}/mapGETX
Set/update location map/location/{id}/mapPOSTX

Spaces

Function EndpointMethodAnonymous User Org Admin Super Admin
Get one space/location/{locationId}/space/{id}GETX
Update one space/location/{locationId}/space/{id}PUTX
Delete one space/location/{locationId}/space/{id}DELETEX
Get all spaces in a location/location/{locationId}/space/GETX
Create a new space in a location/location/{locationId}/space/POSTX
Get spaces with availability information for a specific time period/location/{locationId}/space/availabilityPOSTX

Organisations

Function EndpointMethodAnonymous User Org Admin Super Admin
Get one organization/organization/{id}GETX
Update one organization/organization/{id}PUTX
Delete one organization/organization/{id}DELETEX
Get all organizations/organization/GETX
Create a new organization/organization/POSTX
Get organization for domain/organization/domain/{domain}GETX
Get all domains for an organization/organization/{id}/domain/GETX
Add a new domain to an organization/organization/{id}/domain/{domain}POSTX
Remove a domain from an organization/organization/{id}/domain/{domain}DELETEX
Verify DNS-TXT-Record for a domain/organization/{id}/domain/{domain}/verifyPOSTX
Function EndpointMethodAnonymous User Org Admin Super Admin
Get search results for keyword/search/{keyword}GETX

Settings

Function EndpointMethodAnonymous User Org Admin Super Admin
Get all settings/setting/GETX
Update all settings/setting/PUTX
Get one setting/setting/{name}GETX
Update one setting/setting/{name}PUTX

Signup

Function EndpointMethodAnonymous User Org Admin Super Admin
Signup and init double-opt-in/signup/POSTX
Complete double-opt-in process/signup/confirm/{id}POSTX

Statistics

Function EndpointMethodAnonymous User Org Admin Super Admin
Get organization's stats/stats/GETX

Users

Function EndpointMethodAnonymous User Org Admin Super Admin
Get one user/user/{id}GETX
Update one user/user/{id}PUTX
Delete one user/user/{id}DELETEX
Set a user's password/user/{id}/passwordPUTX
Get all users of an organization/user/GETX
Create a new user in an organization/user/POSTX
Get user's own details/user/meGETX

Auth Providers

Function EndpointMethodAnonymous User Org Admin Super Admin
Get one auth provider/auth-provider/{id}GETX
Update one auth provider/auth-provider/{id}PUTX
Delete one auth provider/auth-provider/{id}DELETEX
Get all auth providers of an organization/auth-provider/GETX
Create a new auth provider in an organization/auth-provider/POSTX
Get public auth provider information for an organization/auth-provider/org/{id}GETX