tribe / api
JSON API for Tribe (v3)
v1.0.17
2024-10-29 01:48 UTC
Requires
- alsvanzelf/jsonapi: ^2.4
- tribe/auth: ^3.0
- tribe/core: ^4.0
- dev-master
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.2
- v0.1.18
- v0.1.17
- v0.1.16
- v0.1.15
- v0.1.14
- v0.1.13
- v0.1.12
- v0.1.11
- v0.1.10
- v0.1.9
- v0.1.8
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- dev-fix-auth
- dev-add-license-1
- dev-dev
This package is auto-updated.
Last update: 2025-02-14 01:50:14 UTC
README
JSON API implementation based on https://jsonapi.org/format
Usage
To authorise
- Authorise yourself with Basic HTTP authentication, using API Key (as username) and API Secret (as password) generated from Junction.
- Save the array returned. The array has a column called "access_token". This is the Bearer access token to be used to access data.
Data handling
Read Single object
GET request on /api/$type/$slug
or /api/$id
Read Multiple objects of one $type or search
GET request on /api/$type
or /api/search
Pagination
GET request on /api/$type?index=0&limit=25
Sorting
Filtering
Data can be cherry picked passing the "filter" query in URL with the desired data.
GET
request using ?filter=name,age,location,email
To create record
POST request on /api/$type
preferably include: user_id (of creator) and content_privacy
To edit/update record
PATCH request on /api/$type/$slug
or /api/$type/$id
To delete record
DELETE request on /api/$type/$slug
or /api/$type/$id
mandatory to include: user_id (of creator)
Upload interface
POST /api/file-upload
- Include the js file
tribe_upload.js
underdist
in your project (or use it as a reference to implement your own) - create a button that you want to program for upload with a
data-target='#input-file'
('#input-file' can be anything you want, but mention a target) - Initialize the code by passing selector of your event initiator (i.e. button created in step 2) and defining the api URL
tribeUploadUrl
<form action="#"> <input type="file" name="upload[]" id="upload" class="form-control mb-3" multiple> <button type="submit" class="btn btn-primary" id="form-submit" data-target="#upload">Submit</button> </form>
tribeUploadButton('#form-submit'); let tribeUploadUrl = '/api/file-upload'
Important info
- A type cannot be deleted or modified using API. The only way to modify types is by modifying config/types.json in your Tribe root directory.
- Multple records cannot be deleted or modified using API.