Programmatically adding properties with REST API

Hello,

I would like to add properties to an existing vocabulary with the REST API, but don’t understand how I must define the vocabulary in the payload. I tried this structure:

{
          'o:local_name': 'blablabla',
          'o:label': 'blablabla',
          'o:vocabulary': {
            'o:id': <vocabulary_id>
          }
}

… but get the error:

{ errors: { 'o:vocabulary': [ 'A vocabulary must be set.' ] } }

Thank you all for any help you can offer :slight_smile:

The API is designed to encourage treating vocabularies as somewhat fixed, rather than adding or removing properties from existing vocabularies, the API is more set up around adding a new vocabulary (you can specify properties for a new vocabulary as part of the creation of the vocabulary itself).

So, the API actually doesn’t allow you to set a vocabulary ID directly like this.

This error message could be more clear, certainly.

Thank you very much for your answer. I ended up creating the properties with the vocabulary.