Skip to content

httpGet - pluck options out of GET response #127

@IckleChris

Description

@IckleChris

I have a need for a field that retrieves its options via an HTTP request (to an API). The structure of the response to that GET request is, for example;

{
    _embedded: {
        people: [
            // The array of options
        ]
    }
}

I found the optionsCallback option in the documentation however since the form schema (which is dynamic and provided by an API) could in theory contain infinite different API endpoint providers of options for different fields (with differing response keys in place of "people") creating a callback to pluck the options out is less feasible.

Is there a way to do something similar to the following? Thanks

"options": {
    "multiple": "true"
    "httpGet": {
        "url" : "http://my-api.com/people",
        "dataPath": "_embedded.people"
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions