跳轉到

API

Planning REST API

The new REST API is now under planning and heavy development. Any update or announcement in the future will be published here.

coscup_volunteer_api_flow

Authorization flow, [original]

Planning

  • API Token.
  • Remove all sessions.
  • User self info
    • GET
    • POST: bank, resume, address, dietary habit, real profile
  • Get users public info
  • List all projects.
  • Creat a project.
  • Update traffic subsidy.
  • List all Teams.
  • Create a new team.
  • Add / delete chiefs
  • Add / delete members.
  • List available forms.
  • List all tasks.

API Docs

The interactive API docs are provided by Swagger UI included in fastAPI.

Getting started

Creating an application

Right now we do not support the application identifier way to create the volunteer app, but we are working in progress.

User authorization

  1. Get the temporary and ont-time-use exchange username, password from here.
  2. Submit a POST request to /api/token to get the api token.
  3. Submit the request with a header Authorization with a value of Bearer plus the api token.
  4. ... or make a try in the api docs.

Deprecated API

Warning

The api endpoint of /members is deprecated, using /members/{pid} instead.

GET /members

To show all the members in the project.

Name Type Description
pid string Project ID
curl https://volunteer.coscup.org/api/members?pid=2022
  • Status: 200
  • Content Type: application/json
{
  "data": [
    {
      "name": "總召組 - General Coordinator",
      "tid": "coordinator"
      "chiefs": [
        {
          "email_hash": "86d3bee674f1962af04b0192f0c959f3",
          "name": "球魚/Ballfish"
        },
        {
          "email_hash": "9c08215f31eb6005a25be6521bf47b0a",
          "name": "Denny Huang"
        },
        {
          "email_hash": "4b0cdd9418513546c11c12f181f51c0f",
          "name": "Toomore"
        }
      ],
      "members": [
        {
          "email_hash": "80bba454a8b37dba920e8787f78b3b81",
          "name": "Singing"
        },
        {
          "email_hash": "8ba17c693edf1f29ae77d64443ac242e",
          "name": "nfsnfs"
        }
      ],
    },
    ...
  ]
}