How to get Object value via API

Infos:

  • Used Zammad version: 3.2.0
  • Used Zammad installation source: GitHub
  • Operating system: Ubuntu
  • Browser + version: chrome

Hi, please assist:

I added some object fields into db\seeds\object_manager_attributes.rb

like

ObjectManager::Attribute.add(
  force:       true,
  object:      'Organization',
  name:        'azuredevops_organization',
  display:     'Azure DevOps Organization',
  data_type:   'input',
  data_option: {
    type:       'text',
    maxlength:  150,
    null:       false,
    item_class: 'formGroup--halfSize',
    permission: ['admin.organization'],
  },
  editable:    false,
  active:      true,
  screens:     {
    edit: {
      '-all-' => {
        null: false,
      },
    },
    view: {
      '-all-' => {
        shown: true,
      },
    },
  },
  to_create:   false,
  to_migrate:  false,
  to_delete:   false,
  position:    1550,
)

I try to get its value by API, but api returns only default fields.

GET /api/v1/organizations/{id}

please advice how include object data or get in by an additional request

Congrats.
You just changed the seed file which does not add any fields to Zammad.
Please use the UI or rails console (if you feel super mighty doing so).

The following page will help you:
https://admin-docs.zammad.org/en/latest/system-objects.html

do you mean I have to add smth more? what if I want use the seed?

Seeds are run during setup, so that’s not what you want.
You could use migrations, however, this is out of scope - I won’t help you further at this point, I’m sorry.

As the code you got in your seeds basically already is rails console magic, you could just run it inside the console. -However- this is not the suggested way and might thus differ from the “usual way”.

Safest way is to use the UI.
Whatever way you take, don’t forget to restart Zammad, as these changes require database updates and application reloads.

I want run it during setup

Then it to the seeds before hand and follow the installation.
This is as far as I can help you.

In this case I can see this fields, but cannot take em via the api

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.