Query all optionsets with all attribute values

we found in how-can-i-access-option-sets-through-the-api
that one can create a backend workflow api endpoint to output optionset values.

However, it only outputs one attribute (Display Value). We would need to output all optionsets with values of all nested attributes.

Is there an elegant way to do this quickly and elegantly?

Get an Option:All options:filtered: This Option’s Attribute contains List (your list)

I tried to replicate this approach, however, we dont want to filter by attribute, we want to return all options with all each attributes with all each values at the same time. With your approach it seems we still only can return one attribute at a time.

No clue what you’re trying to do. Can you explain the use case in context?

OK so we have a lot of optionsets. Each optionset has many attributes. We need to export all this info to integrate it with an external mapping service. We built a backend workflow to expose the options as API endpoint. Now we need to return all the options with all attributes as nested JSONS.

What we need:

{
"myoptionseet": [
     {"Display": "a1", "attribute1": "value", "attribute2": "value"}
     {"Display": "a2","attribute1":"value","attribute2:"value"}
]
}

The Editor only allows to print out one attribute at a time, there is not setting like :allitems()

We tried to use format as text to print out all attributes, but even this fails.

This would work but you need the output type to be Other content-type then make it application/json and put your format as text expression in there. Make sure you don’t have any newlines in the format as text area as it’ll break the JSON.

yes but then we would have to define all the attributes as key-value pairs, which is a lot of work. Is there a way to just output all options with all attributes and values dynamically so when we add option attributes later, they are automatically included?

No there isn’t. How many attributes does it have? In the time taken to write the message you could’ve probably done 10 :slight_smile:

@geo1, you can use the format as text to create the key-value pairs as long as you have a key attribute on the OS.

This topic was automatically closed after 70 days. New replies are no longer allowed.