# How to get the label of fields from API?

**URL:** <https://discourse.getcockpit.com/t/how-to-get-the-label-of-fields-from-api/1141>\
**Category:** Support\
**Created:** [January 2, 2020, 4:49pm UTC](https://discourse.getcockpit.com/t/how-to-get-the-label-of-fields-from-api/1141 "2020-01-02T16:49:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xeonicca](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/xeonicca/32/461_2.png) [@xeonicca](https://discourse.getcockpit.com/u/xeonicca)\
**Post date:** [January 2, 2020, 4:49pm UTC](https://discourse.getcockpit.com/t/how-to-get-the-label-of-fields-from-api/1141/1 "2020-01-02T16:49:55Z")

</div>

When accessing collection api, I get a field response with props as followed:

```auto
name: "average_weight"
type: "text"
localize: false
options: []

```

How do I get the field label name and info from the dashboard as well?

---

<div class="post-metadata">

**Author:** ![xeonicca](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/xeonicca/32/461_2.png) [@xeonicca](https://discourse.getcockpit.com/u/xeonicca)\
**Post date:** [January 2, 2020, 4:58pm UTC](https://discourse.getcockpit.com/t/how-to-get-the-label-of-fields-from-api/1141/2 "2020-01-02T16:58:19Z")

</div>

Looks like I can edit `modules/Collections/Controller/RestApi.php` to make it return additional fields. Still wondering if there is setting for this thou.

---

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [January 10, 2020, 4:19pm UTC](https://discourse.getcockpit.com/t/how-to-get-the-label-of-fields-from-api/1141/3 "2020-01-10T16:19:45Z")

</div>

Interesting. I never noticed/missed the missing information - and I’m not sure, if it would be a useful default setting. 1. It could bloat the api request and 2. I use the label and the info fields to give clients detailed information about how to fill the content. For the frontend, I’m only interested in the field names…

You could write your own api endpoint:

- Create a file `/path/to/cockpit/config/api/collections/get/collection_name.php`
- copy/paste the content from `modules/Collections/Controller/RestApi.php::get()` with minor modifications
- change the response with your needed field information
- call the api like before `example.com/api/collections/get/collection_name`
