Pack Building Roadmap - Maker Stories Webinar
Share
Explore
Pack Details & Code

icon picker
TBCountries Code

//Starter code for all packsimport * as coda from "@codahq/packs-sdk";export const pack = coda.newPack();
//Identify API domain namepack.addNetworkDomain("travelbriefing.org");

//Add a Formulapack.addFormula({ name: "TBCountries", description: "Return all countries from the travelbrief website.", parameters: [ ],

//Return country names and urls in response.bodyresultType: coda.ValueType.String,
execute: async function ([], context) { let url = "https://travelbriefing.org/countries.json"; let response = await context.fetcher.fetch({ method: 'GET', url }); return response.body; } });
/* Postman Responses to API Get call: Example List of Countries
https://travelbriefing.org/countries.json
{
"name": "Afghanistan",
"url": "https://travelbriefing.org/Afghanistan?format=json"
},
{
"name": "Aland Islands",
"url": "https://travelbriefing.org/Aland_Islands?format=json"
},
{
"name": "Albania",
"url": "https://travelbriefing.org/Albania?format=json"
},*/

Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.