This flow contains mockups of some potential new nodes: Node-Red-4-farmOS/farmOS_New_Oauth2_GET.json at WIP · Farmer-Eds-Shed/Node-Red-4-farmOS · GitHub
2 new nodes for Authentication, farmOS Callback node handles Endpoint for Redirect URI with Authorization Code Grant.
farmOS GET new advanced version of the API Node, currently only GET but accepts endpoints and filters directly from msg.payload
or a global/flow variable or defined in Node properties. Can also be connected before a Dropdown UI to populate all farmOS API endpoints or directly after to receive required endpoint and/or filter.
2 additional Nodes that are not particularly farmOS nodes but make using Dropdown Lists in the Dashboard UI Simpler.
Load Selection Loads UI Dropdown Nodes from a Json File
Save Selection Saves UI Dropdown Selection to a definable global or flow Variable.
example json file for Load Selection:
{
"asset_filters":[
{"No Filter":""},
{"Flag monitor":"filter[flag]=monitor"},
{"Flag monitor & Female":"filter[flag]=monitor&filter[sex]=F"},
{"Active":"filter[status]=active"}
],
"asset_enpoints":[
{"asset--animals":"asset--animal"},
{"asset--land":"asset--land"},
{"asset--equipment":"asset--equipment"}
]
}
Or maybe This would make more sense to store a list of filters specific to the different API endpoints?
{
"asset--animals":[
{"No Filter":""},
{"Flag monitor":"filter[flag]=monitor"},
{"Flag monitor & Female":"filter[flag]=monitor&filter[sex]=F"},
{"Active":"filter[status]=active"}
],
"asset--land":[
{"Active":"filter[status]=active"},
{"No Filter":""}
],
"log--activity":[
{"Done":"filter[status]=done"},
{"Pending":"filter[status]=pending"},
{"No Filter":""}
]
}
This is all fairly rough and will probably need some further debugging and documenting, but if anyone wants to give it a go, feel free.