# Select field options from Panel API

**URL:** <https://forum.getkirby.com/t/select-field-options-from-panel-api/12945>\
**Category:** Questions\
**Tags:** v3\
**Created:** [February 18, 2019, 1:29pm UTC](https://forum.getkirby.com/t/select-field-options-from-panel-api/12945 "2019-02-18T13:29:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![georgobermayr](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/georgobermayr/32/6112_2.png) [@georgobermayr](https://forum.getkirby.com/u/georgobermayr)\
**Post date:** [February 18, 2019, 1:29pm UTC](https://forum.getkirby.com/t/select-field-options-from-panel-api/12945/1 "2019-02-18T13:29:11Z")

</div>

Hi,

is it not possible to get the options for a select field from a custom Panel API route. I can’t make this work:

Blueprint:

```auto
                  option:
                    label: Filter option
                    type: select
                    options: api
                    api:
                      url: "{{ site.url }}/api/filterOptions"
                      text: "{{ item.name }}"
                      value: "{{ item.slug }}"

```

Route in the plugin:

```auto
'api' => [
    'routes' => [
        [
        'pattern' => 'filterOptions',
        'action' => function() {
          return [
            [
              'name' => 'Name 1',
              'slug' => 'slug 1'
            ],
            [
              'name' => 'Name 2',
              'slug' => 'slug 2'
            ],
            [
              'name' => 'Name 3',
              'slug' => 'slug 3'
            ],
         ];
       }
    ]
  ]
],

```

What am I missing here?

Thank you,  
Georg

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 18, 2019, 2:07pm UTC](https://forum.getkirby.com/t/select-field-options-from-panel-api/12945/2 "2019-02-18T14:07:29Z")

</div>

Can’t make this work, either, maybe it’s not supposed to work.

---

<div class="post-metadata">

**Author:** ![georgobermayr](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/georgobermayr/32/6112_2.png) [@georgobermayr](https://forum.getkirby.com/u/georgobermayr)\
**Post date:** [February 18, 2019, 2:22pm UTC](https://forum.getkirby.com/t/select-field-options-from-panel-api/12945/3 "2019-02-18T14:22:30Z")

</div>

Okay, I will go with a regular route then.  
Would be nice to have this work tough, to have a better distinction between internal and external routes.

---

<div class="post-metadata">

**Author:** ![moeli](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/moeli/32/8964_2.png) [@moeli](https://forum.getkirby.com/u/moeli)\
**Post date:** [February 18, 2019, 5:30pm UTC](https://forum.getkirby.com/t/select-field-options-from-panel-api/12945/4 "2019-02-18T17:30:51Z")

</div>

The request to the api would need to be authenticated I guess. And there are no credentials sent [with the request](https://github.com/getkirby/kirby/blob/master/src/Form/OptionsApi.php#L55).

---

<div class="post-metadata">

**Author:** ![steirico](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/steirico/32/5466_2.png) [@steirico](https://forum.getkirby.com/u/steirico)\
**Post date:** [February 18, 2019, 9:28pm UTC](https://forum.getkirby.com/t/select-field-options-from-panel-api/12945/5 "2019-02-18T21:28:08Z")

</div>

@moeli is right. I’ve tried that, too.

The query syntax allows methods of page models and custom methods as well ([Query Language](https://getkirby.com/docs/guide/blueprints/query-language#introduction)). That might be a way to go.

---

<div class="post-metadata">

**Author:** ![ahmetbora](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/ahmetbora/32/11671_2.png) [@ahmetbora](https://forum.getkirby.com/u/ahmetbora)\
**Post date:** [July 31, 2019, 10:50am UTC](https://forum.getkirby.com/t/select-field-options-from-panel-api/12945/6 "2019-07-31T10:50:27Z")

</div>

@texnixe [Options via API](https://getkirby.com/docs/reference/panel/fields/select#options-via-api) \>\> This API is not “Kirby API” right?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [July 31, 2019, 11:49am UTC](https://forum.getkirby.com/t/select-field-options-from-panel-api/12945/7 "2019-07-31T11:49:19Z")

</div>

Exactly, that means you own route or an external API.
