Core APIs
Text
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 { "tab" "examples", "url" "https //orca pathfix com/functions/text/switch", "name" "switch api", "method" "post", "request" { "pathparameters" \[], "queryparameters" \[], "headerparameters" \[], "bodydataparameters" \[], "formdataparameters" \[] }, "results" { "languages" \[ { "id" "qbpxuptxpiybh5mp0bwxk", "code" "{\n\t\\"output\\" \\"fb\\"\n}", "language" "200" }, { "id" "mcn80kfmuvw1altgeskpp", "code" "{\n \\"message\\" \\"error\\"\n}", "language" "404" } ], "selectedlanguageid" "qbpxuptxpiybh5mp0bwxk" }, "examples" { "languages" \[ { "id" "ddo a hrdh8pbi1umd5yo", "code" "{\r\n\t\\"input\\" \\"facebook\\",\r\n\t\\"switch\\" {\r\n\t\t\\"facebook\\" \\"fb\\",\r\n\t\t\\"fbook\\" \\"fb\\",\r\n\t\t\\"facebook\\" \\"fb\\",\r\n\t\t\\"facebk\\" \\"fb\\",\r\n\t\t\\"linkedin\\" \\"li\\",\r\n\t\t\\"linkedin\\" \\"li\\",\r\n\t\t\\"linkin\\" \\"li\\"\r\n\t},\r\n\t\\"default\\" \\"unknown source\\"\r\n}", "language" "json" } ], "selectedlanguageid" "ddo a hrdh8pbi1umd5yo" }, "description" "call the following api to switch a response with a standard output", "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" } } use cases best used for when you want to standardize a response received from multiple providers/sources