-
DummyJSON
DummyJSON.com provides different types of REST Endpoints filled with JSON data which you can use in developing the frontend with your favorite framework and library without worrying about writing a backend.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
import json import requests def lambda_handler(event, context): base_url = 'https://dummyjson.com/' product_id = '1' resp = requests.get(url=base_url+'products/'+product_id) if resp.status_code != 200: raise Exception('Failed to retrieve product: '+resp.text) return { 'statusCode': resp.status_code, 'body': resp.json() } Q. what this code does? 1.Imports the necessary modules (JSON and requests). 2.Defines a base URL and a product ID that will be used to construct the API URL. 3.Sends a GET request to the API using the requests library, passing in the full API URL. 4.Checks the response status code to make sure that the request was successful (status code 200). 5.If the response status code is not 200, raise an exception with an error message that includes the response text. 6.If the response status code is 200, return a dictionary containing the response status code and the parsed JSON response body. ●Test the function.
Related posts
-
Next Auth boilerplate TS
-
Integrating GraphQL Codegen + React Query + Clerk JWT Tokens
-
UI for fake REST API challenge. How would you rate my skills?
-
What are some of the simplest web applications and/or API's out there that are popular
-
Spacetraders is an online multiplayer game based entirely on APIs. You have to build your own management and UI on your own with any programming language.