# API ## What is it "API" stands for "Application Programming Interface" Can be written in any programming [[Scripting Languages|language]] [[Postman]] used to access API with limited coding ## Programs with API [List of APIs](https://apitracker.io/categories) [weather](https://rapidapi.com/weatherapi/api/weatherapi-com/) [ThemeParks by fans](https://www.themeparks.wiki/) [[Airtable]] [[Amazon Alexa]] [[Asana]] [[ClickUp]] [[Mem]] [[Notion]] [[Plaid]] [[Unsplash]] [[Youtube]] %% Possibly Missing from list above: ```dataview LIST FROM "Program" WHERE contains(this.file.inlinks, file.link) and !contains(this.file.outlinks, file.link) SORT file.name ASC ``` Full list:: ```dataview LIST FROM "Program" WHERE contains(this.file.inlinks, file.link) SORT file.name ASC ``` %% ### Plugins with API #### for [[Obsidian]] **movie grabber** [[Obsidian#Plug-ins|Plugin]] Examples: [Obsidian Media DB Plugin](https://github.com/mProjectsCode/obsidian-media-db-plugin/blob/master/src/api/apis/BoardGameGeekAPI.ts) [Obsidian API Request](https://github.com/Rooyca/obsidian-api-request/blob/master/main.ts) [Obsidian Readwise](https://github.com/readwiseio/obsidian-readwise) [Obsidian to Notion](https://github.com/EasyChris/obsidian-to-notion) [Obsidian Local Rest API](https://github.com/coddingtonbear/obsidian-local-rest-api) ## Tutorials [How to use, by Zapier](https://zapier.com/blog/how-to-use-api/) [how to use](https://technologyadvice.com/blog/information-technology/how-to-use-an-api/) [reqbin](https://reqbin.com/) [rest intro](https://www.infoq.com/articles/rest-introduction/) ## API Basics How to make an API call [^source1] 1. Find the URI (Uniform Resource Identifier) [^1] of the external server or program 2. Add an HTTP verb - 4 most basic: - **GET**: To retrieve a resource - **POST**: To create a new resource - **PUT**: To edit or update an existing resource - **DELETE**: To delete a resource 3. Include a header - 3 common headers: - `User-Agent` - `Content-Type` - `Accept` - Basically gives definitions/specific info to API for things it may not infer 1. Include an API key or access token [^1]: A URI can be made up of several components, including the host name or IP address, port number, the path, and an optional query string [^source1]: https://blog.hubspot.com/website/api-calls #### Examples: `GET  https://developer.nrel.gov/api/alt-fuel-stations/v1/nearest.json?api_key=XXXXXXXXX&location=Denver+CO` Header: `get.setHeader("User-Agent", "my-integration/1.2.3");` `POST https://language.googleapis.com/v1/documents:analyzeEntities?key=API_KEY` #### Test can use [ReqBin](https://reqbin.com/) (seems to be a good example for explanations of basics as well) to "testing consists of making API calls to different endpoints, getting responses, and validating the status codes, response times, and data in those responses" [[Open and Free APIs]] #### Resulting Codes ###### [[HTTP]] response code: Success: 2XX - 200 OK - 201 Created - 202 Accepted - 204 No Content Error: 4XX - 400 Bad Request - 401 Unauthorized - 403 Forbidden - 404 Not Found - 429 Too Many Requests Server: 5xx - 500 Server Error - 503 Service Unavailable - 504 Gateway Timeout Can put results into excel `Json.Document(Web.Contents(" {{insert request}} ")` ### [[HTML]] ## REST API "Representational State Transfer" The server must store no user data and must receive everything it needs from the client. ## Resources [[Resource Index|All Resources]] ```dataview LIST FROM [[]] WHERE !contains(fileClass, "Primary") and contains(file.folder,"Resources") Sort file.name ``` # #Inbox https://learn.microsoft.com/en-us/graph/api/resources/excel?view=graph-rest-1.0&preserve-view=true - [[Microsoft Excel]] - Microsoft Graph - https://learn.microsoft.com/en-us/sharepoint/dev/general-development/excel-services-rest-api - https://learn.microsoft.com/en-us/office/dev/add-ins/reference/overview/excel-add-ins-reference-overview - https://learn.microsoft.com/en-us/graph/excel-concept-overview - https://blog.coupler.io/connect-api-to-excel/