Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Card numbers on API

Ashley_Abell May 8, 2018

For example we have this power up Card Numbers by Reenhanced

It shows when I call /boards/{id}/boardPlugins and /boards/{id}/plugins

Is there any way to get the prefix that has been set for this power up?

Thanks

Ashley

1 answer

0 votes
bentley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 14, 2018

@Ashley_AbellCan you go into more detail what you mean by prefix?

The card number that they are using is returned as the idShort in the API. For instance, using a public board, you can retrieve the field with the following call: https://api.trello.com/1/boards/ALJlJokP/cards/?limit=1&fields=idShort

Ashley_Abell May 14, 2018

idShort is what we're getting but we want the prefix from the powerup in the screenshot attached so we can put them both together like it shows on the card itself.

prefix.png

Ashley_Abell May 14, 2018

card.PNG

bentley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 14, 2018

Ah, yeah - I see!

It looks like they are storing that at the board-level in pluginData. You can get at this data with the following API request:

https://api.trello.com/1/boards/{idBoard}/pluginData/5af9c282a659e51fde5aef26

This works because the Card Numbers Power-Up's ID is: 5af9c282a659e51fde5aef26. When you make this request you will get a response similar to:

{
"id": "5af9c282a659e51fde5aef26",
"idPlugin": "59c3d177178a761767b49278",
"scope": "board",
"idModel": "586e8f681d4fe9b06a928307",
"value": "{\"prefix\":\"ohLookThePrefix\"}",
"access": "shared"
}

And you can see in the value key the prefix is there.

Ashley_Abell May 15, 2018

I keep getting pluginData not found errors.

Below is the result from this request: /boards/{boardId}/boardPlugins

I've tried every combination of but still getting 404's. Anything you can do on your end to see if I've got the right details

array (size=2)
0 =>
object(stdClass)[408]
public 'id' => string '5aec6afde0e2cb5e58e3b283' (length=24)
public 'idBoard' => string '5aec47bb0623fa833993acf1' (length=24)
public 'idPlugin' => string '56d5e249a98895a9797bebb9' (length=24)
1 =>
object(stdClass)[407]
public 'id' => string '5aec6b0577b3ea8f3ed52a54' (length=24)
public 'idBoard' => string '5aec47bb0623fa833993acf1' (length=24)
public 'idPlugin' => string '59c3d177178a761767b49278' (length=24)

bentley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 15, 2018

Looks like I misspoke. You need to get all of the pluginData for the board first:

https://api.trello.com/1/boards/{idBoard}/pluginData/

This will return all of the pluginData that has been set on the board, including the data set by Card Numbers. You can parse through it to find the Card Numbers plugin ID (59c3d177178a761767b49278):

{
"id": "5af9c282a659e51fde5aef26",
"idPlugin": "59c3d177178a761767b49278",
"scope": "board",
"idModel": "586e8f681d4fe9b06a928307",
"value": "{\"prefix\":\"ohLookThePrefix\"}",
"access": "shared"
}

And then you can access that specific set of pluginData via the ID:

https://api.trello.com/1/boards/{idBoard}/pluginData/{id}

Using the example response from above, we'd use:

https://api.trello.com/1/boards/586e8f681d4fe9b06a928307/pluginData/5af9c282a659e51fde5aef26

Ashley_Abell May 15, 2018

Thanks, I got it now.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events