REST API Automation Guide

📖 15 min read 🔴 Advanced

TribeOps exposes a clean REST API that allows you to trigger imports, query lists, queue listing bulk edits, and execute synchronizations programmatically. You can build custom workflows or hook it up to third-party tools like Make.com, Zapier, or internal systems.

Step 1: Generate API Access Tokens

Authentication is handled via secure Laravel Sanctum tokens. To create a key:

  1. Go to Settings > API Access in your TribeOps panel.
  2. Click Generate Token.
  3. Provide a descriptive label (e.g. "Zapier Integration Service").
  4. Assign scopes (e.g. listings:write, imports:run).
  5. Copy the token key. For security, it will only be displayed once.

⚠️ Warning: Treat tokens like passwords. Do not commit keys to public GitHub repositories. Use secure environment variables instead.

Step 2: Authenticating HTTP Requests

Pass your token in the HTTP headers of all API requests using the Bearer schema:

Authorization: Bearer YOUR_SECRET_API_TOKEN
Accept: application/json
Content-Type: application/json

Step 3: Common API Scenarios

A. Triggering a New CSV Import

Initiate a background listing import by sending a POST request to the import route. You can specify destination configurations and mappings in the payload:

POST /api/imports/trigger
{
  "source_type": "csv",
  "import_entity": "listing",
  "file_url": "https://example.com/listings.csv",
  "import_mode": "upsert",
  "match_key": "title"
}

Response contains a job_id which you can poll to check progress status.

B. Querying Import Job Status

GET /api/imports/status/{job_id}

Returns progress percentage, processed count, error counts, and job status (e.g. parsing, validating, importing, completed).

C. Queuing a Listing Update

To update specific attributes without triggering full imports, use the bulk-edit endpoint:

POST /api/listings/update
{
  "listing_id": "sharetribe-listing-uuid",
  "field": "price",
  "value": 1500.00,
  "data_type": "number"
}

Step 4: Error Handling and Rate Limits

The REST API implements standard HTTP response codes:

  • 200 OK / 201 Created: Success.
  • 400 Bad Request: Missing mandatory fields.
  • 401 Unauthorized: Missing or invalid token.
  • 403 Forbidden: User role has restricted access or lacks scopes.
  • 429 Too Many Requests: Rate limit exceeded (Default: 60 requests per minute).