Switch
2 min
Switches the reponse based on the input provided. e.g if you are looking for a 'convert all reponses to a standardized output
The default attribute instructs the function to return the value in default if none of the other items match. In the current example if the "input" were "twitter" the response would be "unknown source"
API Definition
Switch API
Call the following API to switch a response with a standard output
POST
https://orca.pathfix.com/functions/text/switch
{
"input": "Facebook",
"switch": {
"Facebook": "fb",
"fbook": "fb",
"facebook": "fb",
"facebk": "fb",
"linkedIn": "li",
"LinkedIn": "li",
"LinkIn": "li"
},
"default":"unknown source"
}
Use Cases
Best used for when you want to standardize a response received from multiple providers/sources.