8

I'm trying to retrieve orders from the REST API in Magento Enterprise 2.3.1, and that's easy enough with endpoints like /rest/default/V1/orders, but while I can see the values for custom options of the items in the order, I can't see their labels. For example:

"product_option": {
    "extension_attributes": {
        "custom_options": [
            {
                "option_id": "3730",
                "option_value": "Some text value."
            },
            {
                "option_id": "3731",
                "option_value": ""
            }
        ]
    }
}

It's great that I can see that for one of the custom options, the customer said "Some text value.", but I'd really like to know what it was they were responding to. What I'd expect to see for each custom option is something like:

{
    "option_id": "3728",
    "option_label": "What's your favorite Star Trek ship?"
    "option_value": "U.S.S. Excelsior"
} 

So far, any time I can find a way to load an order via the REST API, it is returned this way, and I don't see any other way to get the custom option label.

It's hard to believe I'm the first person to come across this - am I just missing something obvious?

7
  • Hello @mike did you got the above solution ? Commented Nov 19, 2019 at 5:58
  • No, as of yet I have no idea. I've been working on some other stuff though, and need to get back to this.
    – Mike
    Commented Jan 9, 2020 at 12:59
  • Hello @mike Have you got the solution? Commented Apr 29, 2020 at 10:25
  • I haven't revisited this in a while, but I haven't seen anything about it, either.
    – Mike
    Commented May 1, 2020 at 18:31
  • Any update on this? Did you get this resolved? Commented Sep 8, 2020 at 14:59

1 Answer 1

0

You can retrieve the option labels from the catalog product endpoint like this:

GET /rest/default/V1/products/{sku}/options/{optionId}

The label will be returned in the response under title.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.