tribe/api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tribe/api

最新稳定版本:v1.1.6

Composer 安装命令:

composer require tribe/api

包简介

JSON API for Tribe (v3)

README 文档

README

JSON API implementation based on https://jsonapi.org/format

Usage

To authorise

  1. Authorise yourself with Basic HTTP authentication, using API Key (as username) and API Secret (as password) generated from Junction.
  2. 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

  1. Include the js file tribe_upload.js under dist in your project (or use it as a reference to implement your own)
  2. 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)
  3. 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.

统计信息

  • 总下载量: 281
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2023-01-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固