1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-21 13:38:56 +02:00
focalboard/server/swagger
Harshil Sharma 63edf2c987
Props to preferences (#3722)
* Added tab;le creation migration

* WIP

* Finished base impl

* Added MySQL migration

* WIP

* Added personal server store methods

* WIP

* Fixed webapp tests

* Updated server tests

* generated code

* generated code

* generated code

* used raw queries instead of plugin methods to avoid updating productapi package

* Added API doc

* Added sqlite migratins

* used plugin APIs again s=instead of raw queries

* WIP

* Added missed case of SQL migration where personal server can run on Postgres and MySQL

* CI

* Removed unsupported POSL operator

* Low on caffine. Making silly mistakes

* json handling

* int test

* hope tests pass

* Fix incorrect column size

* Webapp lint fixes

* remived debug code

* Updated moigration version

* Review fixes
2022-08-29 12:55:12 +05:30
..
docs/html Fix Swagger schema for OnboardingResponse (#2838) 2022-04-18 22:53:41 -07:00
README.md Fix #3072. Add docs on how to auth to API readme. (#3102) 2022-05-25 09:19:02 -07:00
swagger.yml Props to preferences (#3722) 2022-08-29 12:55:12 +05:30

Swagger / OpenAPI 2.0 auto-generated files

⚠️ Warning: The API is currently considered Beta and major changes are planned. Please see this note for more details.

This folder is generated by the make swagger command from comments in the server code.

Prerequisites:

  1. go-swagger
  2. openapi-generator

These can be installed via Homebrew:

brew tap go-swagger/go-swagger
brew install go-swagger
brew install openapi-generator

Server API documentation

See the generated server API documentation here.

How to authenticate

To auth against Personal Server, first call login with your credentials to get a token, e.g.

curl -X POST \
 -H "Accept: application/json" \
 -H "X-Requested-With: XMLHttpRequest" \
 -H "Content-Type: application/json" \
 "http://localhost:8000/api/v2/login" \
 -d '{
  "type" : "normal",
  "username" : "testuser",
  "password" : "testpass"
}'

This should return a token in the form:

{"token":"abcdefghijklmnopqrstuvwxyz1"}

Pass this as the bearer auth to subsequent calls, e.g.

curl -X GET \
 -H "Accept: application/json" \
 -H "Authorization: Bearer abcdefghijklmnopqrstuvwxyz1" \
 -H "X-Requested-With: XMLHttpRequest" \
 -H "Content-Type: application/json" \
 "http://localhost:8000/api/v2/teams/0/boards"

Differences for Mattermost Boards

The auto-generated Swagger API documentation is for Focalboard Personal Server. If you are calling the API on Mattermost Boards, the additional changes are:

API URLs endpoint

The API endpoint is at https://SERVERNAME/plugins/focalboard/api/, e.g. https://community.mattermost.com/plugins/focalboard/api/.

Use the Mattermost auth token

Refer to the Mattermost API documentation here on how to obtain the auth token.

Pass this token as a bearer token to the Boards APIs, e.g.

curl -i -H "X-Requested-With: XMLHttpRequest" -H 'Authorization: Bearer abcdefghijklmnopqrstuvwxyz' https://community.mattermost.com/plugins/focalboard/api/v2/workspaces

Note that the X-Requested-With: XMLHttpRequest header is required to pass the CSRF check.

We want to hear from you!

If you are planning on using the Boards API, we would love to hear about what you'd like to do, and how we can improve the APIs in the future. See here for more details on how to connect.