trello-php icon indicating copy to clipboard operation
trello-php copied to clipboard

Missing API methods

Open andykirk opened this issue 7 years ago • 2 comments

Me again.

So far as I can tell, the following methods are missing:

'getCustomFields' => ['get', 'customFields/%s'],

https://developers.trello.com/v1.0/reference#customfieldsid-3

'getCustomFieldsOptions' => ['get', 'customFields/%s/options'],

https://developers.trello.com/v1.0/reference#customfieldsidoptions-1

'getCustomFieldsOption' =>  ['get', 'customFields/%s/options/%s'],

https://developers.trello.com/v1.0/reference#customfieldsidoptionsidcustomfieldoption-3

Or something along those lines. The Trello docs seem to state both customFields and customField inconsistently - I think the cURL example is a typo.

Cheers.

andykirk avatar Apr 06 '18 14:04 andykirk

For the curious : if you want to fetch the custom fields information from a card, you can do the following :

$client->getBoardCards(
    'xXxXxXx', // board ID
    [
        'customFieldItems' => true,
    ]
);

Which add the following to each card array :

  "customFieldItems" => array:1 [
    0 => array:5 [
      "id" => "xXxXxXx"
      "value" => array:1 [
        "text" => "your custom value..."
      ]
      "idCustomField" => "xXxXxXx"
      "idModel" => "xXxXxXx"
      "modelType" => "card"
    ]
  ]

See https://developers.trello.com/v1.0/docs/getting-started-custom-fields#section-getting-customfielditems-for-cards

gnutix avatar Apr 07 '18 12:04 gnutix

@gnutix thanks for that. I recently discovered that myself (https://github.com/stevenmaguire/trello-php/issues/27#issuecomment-376102340) and I plan to submit a PR explaining that in the docs somewhere.

Cheers

andykirk avatar Apr 09 '18 07:04 andykirk