API question #751

Open
opened 2025-10-09 18:59:53 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @Sourgin on GitHub.

Hi, I'm trying to find a way to retrieve a card and start the timer of foretold.

Any one have an idea of where to start? I had tried several times with "Google F12" as to speak, and didn't saw a clear path to it.

Reading trought the code is a little confusing for me right now.

Thx in advancement.

What I want to do is to hook a python script to cicle trought the retrieved data of the cards and display it on an external display, and use a button to start-stop the timmer, I know its doable for me but dont seem to find where to hook to planka.

Originally created by @Sourgin on GitHub. Hi, I'm trying to find a way to retrieve a card and start the timer of foretold. Any one have an idea of where to start? I had tried several times with "Google F12" as to speak, and didn't saw a clear path to it. Reading trought the code is a little confusing for me right now. Thx in advancement. What I want to do is to hook a python script to cicle trought the retrieved data of the cards and display it on an external display, and use a button to start-stop the timmer, I know its doable for me but dont seem to find where to hook to planka.
OVERLORD added the question label 2025-10-09 18:59:53 +03:00
Author
Owner

@meltyshev commented on GitHub:

Hi! You can find the routes here.

GET request to /api/cards/:id will give you a card.
PATCH request to /api/cards/:id with timer field will set a timer.

Timer field structure: {"startedAt": "2021-03-22T12:34:56.789Z", "total": 60} or null to clear it.

@meltyshev commented on GitHub: Hi! You can find the routes [here](https://github.com/plankanban/planka/blob/master/server/config/routes.js). `GET` request to `/api/cards/:id` will give you a card. `PATCH` request to `/api/cards/:id` with timer field will set a timer. Timer field structure: `{"startedAt": "2021-03-22T12:34:56.789Z", "total": 60}` or `null` to clear it.
Author
Owner

@johnchristopher commented on GitHub:

While we are on the subject: how do you make API call from curl or httpie ? My credentials don't work, I see in the web UI that there's a token being used though.

@johnchristopher commented on GitHub: While we are on the subject: how do you make API call from curl or httpie ? My credentials don't work, I see in the web UI that there's a token being used though.
Author
Owner

@johnchristopher commented on GitHub:

Thanks !

@johnchristopher commented on GitHub: Thanks !
Author
Owner

@Sourgin commented on GitHub:

As I have seen u have to "Login" on /api/access-tokens to retrieve a token that is returned as a json

curl -d 'emailOrUsername=USER&password=PASSWORD' http://localhost:3000/api/access-tokens

Returns
{"item":"<TOKEN>"}

curl -X GET http://localhost:3000/api/projects \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <TOKEN>"

To retrieve a Json with boards

@Sourgin commented on GitHub: As I have seen u have to "Login" on /api/access-tokens to retrieve a token that is returned as a json `curl -d 'emailOrUsername=USER&password=PASSWORD' http://localhost:3000/api/access-tokens` Returns `{"item":"<TOKEN>"}` ``` curl -X GET http://localhost:3000/api/projects \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <TOKEN>" ``` To retrieve a Json with boards
Author
Owner

@Sourgin commented on GitHub:

Update on the work in progress, as stated before working on python 3.9

# This script handles the communication with planka
import requests

# Connection information
baseURL = 'http://localhost:3000/'
username = 'user'
password = 'password'

# Session information
headers = 'empty'

# Get the Token for communications
authentication = requests.post(baseURL+'api/access-tokens', data={'emailOrUsername': username, 'password': password})
headers = { 'Authorization': 'Bearer {}'.format(authentication.json()['item']) }

# Try to retrieve the project list
projects = requests.get(baseURL+'api/projects/', headers = headers)

With this u retrieve the Token used for the communication and use it to retrieve the project list.

I will start working on retrieving the timer of a card and start/stop it. Hope this help other people :3

@Sourgin commented on GitHub: Update on the work in progress, as stated before working on python 3.9 ``` # This script handles the communication with planka import requests # Connection information baseURL = 'http://localhost:3000/' username = 'user' password = 'password' # Session information headers = 'empty' # Get the Token for communications authentication = requests.post(baseURL+'api/access-tokens', data={'emailOrUsername': username, 'password': password}) headers = { 'Authorization': 'Bearer {}'.format(authentication.json()['item']) } # Try to retrieve the project list projects = requests.get(baseURL+'api/projects/', headers = headers) ``` With this u retrieve the Token used for the communication and use it to retrieve the project list. I will start working on retrieving the timer of a card and start/stop it. Hope this help other people :3
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#751