Component Sheet

const square = (x) => x * x

{{JavaScriptone="/components"}}
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

const multiply = (x, y) => {
  return x * y;}

{{JavaScripttwo="/components"}}
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

const numbers = [1, 2, 3, 4, 5];
const doubled = numbers.map((x) => x * 2);
// doubled is now [2, 4, 6, 8, 10]

{{JavaScriptthree="/components"}}
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const evens = numbers.filter((x) => x % 2 === 0);
// evens is now [2, 4, 6, 8, 10]

{{JavaScriptfour="/components"}}
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

const numbers = [1, 2, 3, 4, 5];
const sum = numbers.reduce((acc, x) => acc + x, 0);
// sum is now 15

{{JavaScriptfive="/components"}}
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

const words = ['apple', 'banana', 'cherry', 'date'];
const sorted = words.sort((a, b) => a.localeCompare(b));
// sorted is now ['apple', 'banana', 'cherry', 'date']

{{JavaScriptsix="/components"}}
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

const numbers = [1, 3, 5, 2, 4, 6];
const firstEven = numbers.find((x) => x % 2 === 0);
// firstEven is now 2

{{JavaScriptseven="/components"}}
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

const data = ['apple', 'banana', 'cherry', 'date'];
const allStrings = data.every((x) => typeof x === 'string');
// allStrings is now true

{{JavaScriptseight="/components"}}
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

const numbers = [1, 2, 3, 4, 5];
const hasOdds = numbers.some((x) => x % 2 !== 0);
// hasOdds is now true

{{JavaScriptsnine="/components"}}
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

Component Sheet

₹0
/month*
Starts at
₹770
/month*

Starts at
₹1,150
/month*
Starts at
₹23,000
/month*
Monthly Email Sends
2500
5000
6000
150,000
Users
1 seat
3 seat
5 seat
Unlimited
Customer Support
Email support for
first 30 days
24/7 Email & Chat Support
24/7 Email & Chat Support
Phone & Priority Support
Pre-built Email Templates
yes svg
yes
yes icon
yes tick
300+ Integrations
yes tick
icon
yes
done
Basic Reporting & Analytics
yes
yes
yes
yes
Forms & Landing Pages
yes
yes
yes
yes
Creative Assistant
yes
yes
yes
yes
Role-based Access
x icon
2 roles
4 roles
5 roles
Remove Mailchimp Branding
crossed
yes
yes
yes
A/B Testing
x
tick
yes
yes
Email Scheduling
aa
yes
yes
yes
Automated Customer Journeys
yes
yes
Enhanced
Enhanced
Pre-built Journeys
crossed
ss
yes
yes
Custom-Coded Templates
cross
s
yes
yes
Predictive Segmentation
xx
xx
yes
yes
Content Optimizer
xx
xx
yes
yes
Send Time Optimization
xx
xx
yes
yes
Dynamic Content
xx
xx
yes
yes
Multivariate Testing
xx
xx
xx
yes
Comparative Reporting
xx
xx
xx
yes
Advanced Segmentation
xx
xx
xx
yes
Assisted Onboarding
xx
xx
xx
yes
{{fourcoltable="/components"}}
s
Pros of Zoho Books
Cons of Zoho Books
  • Easy to use: Zoho Books is an easy-to-use software designed to make accounting and bookkeeping simple.
  • Plan restrictions based on user: Zoho Books has several plans, but they all have limits on the number of users, which could be an issue for larger businesses.
  • Cost-effective: It is a budget-friendly solution that can help you save money on costly accounting services. 
  • No payroll services: Zoho Books does not offer payroll services, which can be a downside for those who need them.
  • Manage multiple projects simultaneously: With Zoho Books, you can manage multiple projects simultaneously, which makes it easier to stay organised.
  • Limited reporting features: Zoho books have basic reporting features but may not provide the level of detail needed by businesses with complex operations.
  • Integration with other apps: It integrates with several third-party applications, making tracking and managing your finances easy.
  • No direct phone support: There is no direct phone support for software users, which can be an issue if they need help urgently.
  • Manage, track and categorise expenses in bulk: It allows you to manage, track and categorise expenses in bulk.
  • Limited customisation options: The software is relatively limited in terms of how much users can customise the interface, which may be a problem for those who want more control over their accounting software.
  • Send customised invoices: It allows you to create and send personalised invoices in seconds.
  • Access to the client portal: It gives you access to the client portal, where you can view and manage your customers' data.
{{zoho-pro-con="/components"}}
xx
Pros of Quickbooks:
Cons of Quickbooks:
  • User-friendly design and interface: Quickbooks is user-friendly and has a minimalistic design, making it easier to use.
  • Lack of support: Quickbooks offers limited customer support, which can be an issue if they need help urgently.
  • Accessible data: All the data is stored in the cloud, making it easily accessible with an internet connection.
  • Limited customisation options: The software is relatively limited in terms of how much users can customise the interface, which may be a problem for those who want more control over their accounting software.
  • Multiple payment options: It allows users to pay through multiple methods such as credit cards, bank transfers and PayPal.
  • It can be expensive for businesses with more complex operations: It can be expensive for businesses with more complicated operations, as they may need to upgrade plans and pay extra fees.
  • Real-time data that can be updated in a few clicks: It continuously updates the data in real-time, making it easier to keep track of your business finances.
  • Reports are not customisable and may not provide the detail needed: The reports generated by Quickbooks are not customisable and may not provide the detail required to make critical decisions.
  • Enhanced Security: It offers enhanced security with multi-factor authentication and regular backups.
  • Limitations on the number of users: It limits the number of users that can access its platform, which may be an issue for businesses with multiple employees.
  • Integrates with third-party applications to simplify the process of managing finances: It offers seamless integration with other applications such as payment gateways, POS systems and CRMs.
  • Data is not always backed-up: It does not always back up all the data, so you risk losing important information if there is a system failure.
  • Includes payroll services and automated payment reminders: It offers payroll services and automatic payment reminders for customers.
  • Lack of direct professional support: It does not offer direct professional support, which can be an issue for those who need specific help.
{{quickbook-pro-con="/components"}}
Basis of comparison
MongoDB
SQL Server
Data model
Document-oriented
Relational
Data storage
BSON documents
Tables with rows and columns
Schema
Dynamic
Fixed
Indexing
Wide range of options
Limited set of options
Transactions
Limited support
Full support
Scalability
Horizontal
Vertical or horizontal
Cloud support
Yes
Yes
Ease of management
Moderate
Easy
Security
Moderate
High
Data solutions
Moderate
Comprehensive
Data consistency
Moderate
High
Flexibility
High
Low
XML support
No
Yes
Unstructured data
Good
Poor
Structured data
Poor
Good
{{mongovssql="/components"}}
https://www.boltic.io/blog/mysql-vs-mongodb
Basis 
SNS
SQS
Delivery model
Push-based delivery system
Pull-based delivery system
Subscribers
Sends messages to multiple endpoints with a single API call
Does not have subscribers; messages are retrieved from the queue by consumers
Protocols
HTTP, HTTPS, SMS, email
Custom protocol based on HTTP/HTTPS
Ordering
Does not guarantee the order of delivery for messages
Offers two types of queues: standard queues and FIFO (First-In, First-Out) queues, which guarantee order and no duplicates
Use cases
Event-driven architectures, microservices, serverless applications
Decouple and scale applications, integrate applications using message-based communication, communication between distributed systems
Integration with other services
Can be easily integrated with other AWS services, as well as third-party services
Can be easily integrated with other AWS services, as well as third-party services
Cost
Pay-as-you-go service with no upfront costs or minimum fees
Pay-as-you-go service with no upfront costs or minimum fees
Message size
256 KB
256 KB (standard queues); 256 KB, 1 MB, or 2 MB (FIFO queues)
Message retention
One day to 14 days (configurable)
1 minute to 14 days (standard queues); 1 hour to 14 days (FIFO queues)
{{snstable="/components"}}
https://www.boltic.io/blog/sqs-vs-sns
Characteristic
Always On FCI
Always On AG
Type of availability solution
High-availability
Disaster recovery
Number of copies of the database
Two
Two or more
Automatic failover
Yes
Yes
Redundancy
Provides Instance-level protection without data redundancy
Secondary AG Database(s) are redundant copies of Primary Databases
Data protection level
High
High
Performance impact of data protection
Low
Low
Supported deployment scenarios
Standalone, cluster
Standalone, cluster, distributed
Support for offloading read-only workloads
Yes
Yes
Connection
The application connects via a virtual server name
The application connects via the AG listener name
Support for cross-database transactions
No
Yes
Support for distributed transactions
No
Yes
{{Characteristic="/components"}}
https://www.boltic.io/blog/always-on-sql-server
Feature
Kafka
Spark
Processing type
Real-time
Batch
Data storage
Distributed log
Resilient distributed dataset (RDD)
Data model
Publish-subscribe
Parallel processing
Programming languages
Java, Python, C/C++, C#, Go, Ruby, Node.js
Java, Python, Scala, R
Fault tolerance
Yes
Yes
Stream processing
Yes
Yes
Batch processing
No
Yes
Machine Learning
Limited
Yes (MLlib)
Graph processing
Limited
Yes (GraphX)
Interactive data exploration
Limited
Yes (Spark SQL)
{{Kafka="/components"}}
https://www.boltic.io/blog/spark-vs-kafka
CSV option
bq command flag
Description
Field Delimiter
-F or –field_delimiter
Field delimiter: Comma, Tab, Pipe, Other
Header rows
–skip_leading_rows
Header rows to skip
Number of bad records allowed
–max_bad_records
Number of errors allowed
Newline characters
–allow_
quoted_newlines
Allow quoted newlines
Custom null values
–null_marker
Specifies a string that represents a null value in a CSV file
Trailing optional columns
–allow_jagged_rows
Allow jagged rows
Unknown values
–ignore
_unknown_values
Ignore unknown values
Quote
–quote
The value that is used to quote data sections in a CSV file
Encoding
-E or –encoding
The character encoding of the data
{{csvp="/components"}}
none
Name
Integration
Free trial validity
Boltic
100+ ready-to-use integrations
Lifetime Free Basic Plan
Bright Data
PhantomBuster, SessionBox, Apify, VMLogin, etc.
7 Day Free Trial
Apify
Zapier, Keboola, Transposit, Airbyte, etc.
Lifetime Free Basic Plan
Oxylabs
Ghost Browser, Puppeteer, Selenium, Octoparse, etc.
7 Day Free Trial
Zenscrape
PHP, Node.js, Proxy, etc.
Life Time Free Basic Plan
Smartproxy
Multilogin, AdsPower, VMlogin, GoLogin, Session Box, Proxifier, ScrapeBox, Octoparse, etc.
No free trial, 3-day money-back guarantee instead
Scraper API
NodeJS, Cheerio, Python Selenium, etc.
7 Days Free Trial (No Credit Card Required)
{{BestData="/components"}}
https://www.boltic.io/blog/web-scraping-tools
Feature
Python ETL
Traditional ETL Tools
Flexibility
Python ETL is highly flexible and can handle a wide range of data formats and structures.
Traditional ETL tools are often limited to specific data formats and structures, making it difficult to handle a wide range of data sources.
Cost
Python ETL is typically open-source, making it free to use. The cost of traditional ETL tools can be high, especially for proprietary solutions.
Traditional ETL tools can be expensive, especially for proprietary solutions, and require a significant investment to set up and maintain.
Ease of use
Python ETL is known for its simplicity and ease of use. It's a great choice for developers and data analysts who are familiar with Python programming.
Traditional ETL tools can be complex and difficult to use, especially for those who are not familiar with the specific tool.
Scalability
Python ETL is highly scalable, making it suitable for handling large amounts of data.
Traditional ETL tools can be limited in their ability to handle large amounts of data, requiring organizations to invest in additional hardware and software.
Integration
Python ETL can easily be integrated with other tools and systems, making it an excellent choice for organizations that need to integrate multiple data sources.
Traditional ETL tools can be difficult to integrate with other systems, requiring organizations to invest in additional hardware and software.
{{PythonETL="/components"}}
https://www.boltic.io/blog/python-etl-tools
MongoDB Data Type
BigQuery Data Type
DOUBLE
FLOAT64
STRING
STRING
BINARY DATA
BYTES
OBJECTID
STRING
BOOLEAN
BOOL
DATE
DATE
NULL
NULL
32-BIT INTEGER
INT64
TIMESTAMP
TIMESTAMP
64-BIT INTEGER
INT64
DECIMAL128
DECIMAL128
{{MongoDBData="/components"}}
https://www.boltic.io/blog/migrate-from-mongodb-to-big-query
Type
# of servers
X-Small
1
Small
2
Medium
4
Large
8
X-Large
16
2X-Large
32
3X-Large
64
4X-Large
128
{{x-small="/components"}}
none
SR.
NO
Category
RDBMS
MongoDB
1
Data Structure
RDBMS stores data in the form of tables. Each table consists of columns and rows.
MongoDB stores data in the form of documents. These documents are similar to JSON objects and contain key-value pairs.
2
Data Model
RDBMS uses a relational data model, which is a type of data model that is based on mathematical principles.
MongoDB is a document-oriented database, which means that documents can contain complex data structures.
3
Schema
RDBMS uses a fixed schema, which means that all tables must have the same structure.
MongoDB is a schema-less database, which means that documents can have different structures.
4
Scalability
RDBMS can easily be scaled up or down to accommodate an increase or decrease in data.
MongoDB is designed to scale elastically and can easily be scaled up or down to accommodate an increase or decrease in data.
{{RDBMStable="/components"}}
https://www.boltic.io/blog/relational-database-mongodb
HTTP Method
API Endpoint
Description
GET
/transactions
Get a list of transactions.
GET
/transactions/<transaction_id>
Get a single transaction.
POST
/transactions
Create a new transaction.
PUT
/transactions/<transaction_id>
Update a transaction.
PATCH
/transactions/<transaction_id>
Partially update a transaction.
DELETE
/transactions/<transaction_id>
Delete a transaction.
{{invisible="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/transactions
Get a list of transactions.
GET
/transactions/<transaction_id>
Get a single transaction.
POST
/transactions
Create a new transaction.
PUT
/transactions/<transaction_id>
Update a transaction.
PATCH
/transactions/<transaction_id>
Partially update a transaction.
DELETE
/transactions/<transaction_id>
Delete a transaction.
{{invisible="/components"}}
https://www.boltic.io/blog/python-rest-api
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

select    

warehouse_name,  
 
sum(credits_used_cloud_services) credits_used_cloud_services,      

  sum(credits_used) credits_used

from Snowflake.account_usage.warehouse_history

where  
  
  start_time >= '2020-01-01 00:00:01'

group by 1;

{{Warehouse="/components"}}
https://www.boltic.io/blog/snowflake-pricing
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

select    

warehouse_name,  
 
sum(credits_used_cloud_services) credits_used_cloud_services,      

  sum(credits_used) credits_used

from Snowflake.account_usage.warehouse_history

where  
  
  start_time >= '2020-01-01 00:00:01'

group by 1;

{{Warehouse="/components"}}
https://www.boltic.io/blog/snowflake-pricing
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

select    

query_type,  
 
sum(credits_used_cloud_services) as cloud_services_credits      

from Snowflake.account_usage.query_history

where  
  
  start_time >= '2020-01-01 00:00:01'

group by 1;

{{Query="/components"}}
https://www.boltic.io/blog/snowflake-pricing
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

Example: 

"mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]",  
 
DNS Seed List: Use the prefix "mongodb+srv://" for this type of connection URI.

 Example: 

"mongodb+srv://server.example.com/"  

{{example1="/components"}}
https://www.boltic.io/blog/snowflake-pricing
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

mongoexport --db users --collection cont_collects --type=csv --fields contact_name,contact_address --out /opt/exports/csv/cnts.csv

{{example2="/components"}}
https://www.boltic.io/blog/snowflake-pricing
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

contact_name,contact_address
Elon Wick,27 Manhattan
John Musk,911 Martian Town

For example, you can specify the "contact_name" and "contact_address" fields in a file named "contact_fields.txt":

contact_name
contact_address

{{example3="/components"}}
https://www.boltic.io/blog/snowflake-pricing
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

mongoexport --db users --collection cont_collects --type=csv --fields contact_name,contact_address --query '{"last_updated_time": {"$gt":
1548930176}}' --out /opt/exports/csv/cnts.csv

{{example4="/components"}}
https://www.boltic.io/blog/snowflake-pricing
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

To copy a file to GCS:

gsutil cp file.csv gs://my-bucket

To copy an entire folder:

gsutil -m cp -r folder gs://my-bucket

If the files to be copied are already in S3, the following command can be used:

gsutil cp s3://my-bucket/file.csv gs://my-bucket

{{example5="/components"}}
https://www.boltic.io/blog/snowflake-pricing
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

bq load --source_format=[FORMAT_NAME][DATASET_NAME].[TABLE_NAME] [SOURCE_PATH] [INLINE_SCHEMA]

[FORMAT_NAME] is CSV.
[DATASET_NAME] is an existing dataset in BigQuery.
[TABLE_NAME] is the name of the table where the data should be loaded

[SOURCE_PATH] is the Cloud Storage URI of the data files.
[INLINE_SCHEMA] is a valid schema to describe the data.
The schema can be a local JSON file or can be specified directly.

{{example6="/components"}}
https://www.boltic.io/blog/snowflake-pricing
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

To overwrite the target table:

bq load --source_format=CSV --overwrite [DATASET_NAME].[TABLE_NAME] [SOURCE_PATH] [INLINE_SCHEMA]

To append to the target table:

bq load --source_format=CSV --append [DATASET_NAME].[TABLE_NAME] [SOURCE_PATH] [INLINE_SCHEMA]

{{example7="/components"}}
https://www.boltic.io/blog/snowflake-pricing
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

UPDATE final_table
SET final_table.field1 = interm_delta_table.field1,
 final_table.field2 = interm_delta_table.field2
FROM interm_delta_table
WHERE final_table.key = interm_delta_table.key;

INSERT INTO final_table
SELECT *
FROM interm_delta_table
WHERE interm_delta_table.key NOT IN (SELECT Key FROM final_table);

{{example8="/components"}}
https://www.boltic.io/blog/snowflake-pricing
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api
Framework
API Focus
Gentle learning curve
Active community
Laravel
Yes
Yes
Yes
Lumen
Yes
Yes
Yes
Guzzle
No
Yes
No
Epiphany
Yes
Yes
No
{{phpframework="/components"}}
https://www.boltic.io/blog/what-is-rest-api-in-php
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

DELETE FROM final_table
WHERE Key IN (SELECT Key FROM interm_delta_table);

INSERT INTO final_table

{{example9="/components"}}
https://www.boltic.io/blog/snowflake-pricing
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests
response = requests.get('https://api.example.com/endpoint')

print(response.status_code)
print(response.text)

{{python1="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests
response = requests.get('https://api.example.com/endpoint')

This will send a GET request to the specified endpoint and store the response in the response variable. You can then access the response data like this:

print(response.status_code) # Print the status code
print(response.text)  # Print the response text
print(response.headers)  # Print the response headers

{{python2="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

params = {'key': 'value'}
response = requests.get('https://api.example.com/endpoint', params=params)

To send headers with the request, you can pass a dictionary as the headers argument:

headers = {'Authorization': 'Bearer abc123'}
response = requests.get('https://api.example.com/endpoint', headers=headers)

{{python3="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

data = {'key': 'value'}  # Data to be sent to the server
response = requests.post('https://api.example.com/endpoint', data=data)

{{python4="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

data = {'key': 'value'}  # Data to be sent to the server
response = requests.put('https://api.example.com/endpoint', data=data)

{{python52="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

data = {'key': 'value'}  # Data to be sent to the server
response = requests.patch('https://api.example.com/endpoint', data=data)

{{python53="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

response = requests.delete('https://api.example.com/endpoint')

{{python5="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

<book>
  <title>The Great Gatsby</title>
  <author>F. Scott Fitzgerald</author>
  <year>1925</year>
</book>

{{greatgatsby1="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

{  
    "title": "The Great Gatsby",  
    "author": "F. Scott Fitzgerald",  
    "year": 1925
}

{{python7="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

GET /cars HTTP/1.1
Host: api.vehicleinventory.com

A successful response to this request might look like this:

HTTP/1.1 200 OK
Content-Type: application/json

[
{    
    "id": 1,    
    "make": "Toyota",    
    "model": "Camry",    
    "year": 2020  
},  
{    
    "id": 2,    
    "make": "Honda",    
    "model": "Accord",    
    "year": 2021  
}
]

{{python8="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

GET /cars HTTP/1.1
Host: api.vehicleinventory.com

A successful response to this request might look like this:

HTTP/1.1 200 OK
Content-Type: application/json

[
{    
    "id": 1,    
    "make": "Toyota",    
    "model": "Camry",    
    "year": 2020  
}

{{python9="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

POST /cars HTTP/1.1

Host: api.vehicleinventory.com
Content-Type: application/json

{  
    "make": "Ford",  
    "model": "Mustang",  
    "year": 2022
}

A successful response to this request might look like this:

HTTP/1.1 201 Created
Content-Type: application/json
Location: /cars/3

{  
    "id": 3,  
    "make": "Ford",  
    "model": "Mustang",  
    "year": 2022
}

{{python10="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

PUT /cars/3 HTTP/1.1
Host: api.vehicleinventory.com
Content-Type: application/json

{  
    "make": "Ford",  
    "model": "Mustang",  
    "year": 2023
}

A successful response to this request might look like this:

HTTP/1.1 201 OK
Content-Type: application/json

{  
    "id": 3,  
    "make": "Ford",  
    "model": "Mustang",  
    "year": 2023
}

{{python11="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

PATCH /cars/3 HTTP/1.1
Host: api.vehicleinventory.com

{  
     "year": 2024
}

A successful response to this request might look like this:

HTTP/1.1 200 OK
Content-Type: application/json

{  
    "id": 3,  
    "make": "Ford",  
    "model": "Mustang",  
    "year": 2024
}

{{python12="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

DELETE /cars/3 HTTP/1.1
Host: api.vehicleinventory.com

A successful response to this request might look like this:

HTTP/1.1 204 No Content

{{python13="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

GET /cars/99 HTTP/1.1
Host: api.vehicleinventory.com

In this case, you might return a response like this:

HTTP/1.1 404 Not Found
Content-Type: application/json

{  
    "error": "Car not found"
}

{{python14="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

POST /cars HTTP/1.1
Host: api.vehicleinventory.com
Content-Type: application/x-www-form-urlencoded

make=Ford&model=Mustang&year=2022

In this case, you might return a response like this:

HTTP/1.1 415 Unsupported Media Type
Content-Type: application/json

{  
      "error": "Unsupported media type"
}

{{python15="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

POST /cars HTTP/1.1
Host: api.vehicleinventory.com
Content-Type: application/json

{  
    "make": "Tesla",  
    "model": "Cybertruck",  
    "year": 2025,  
    "num_wheels": 6
}

In this case, you might return a response like this:

HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json

{  
      "error": "Invalid car data"
}

{{python16="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

response = requests.get(    
  'https://api.example.com/endpoint',    
   auth=('username', 'password')
)

{{python17="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

session = requests.Session()

You can then use the session object to make requests just like you would with the get, post, put, and delete functions. For example:

response = session.get("http://api.example.com/endpoint")

{{python18="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

response = requests.get("http://www.example.com")

try:    
     response.raise_for_status()
except requests.exceptions.HTTPError as err:    
     print(f"HTTP error occurred: {err}")

You can also use the Response.status_code attribute to check the status code and handle errors as needed manually. For example:

if response.status_code == 404:    
    print("Page not found")
elif response.status_code == 500:    
    print("Server error occurred")

{{python19="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

# countryapi/settings.py
INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "rest_framework",
    "countries",
]

{{python20="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

from django.db import models

class Country(models.Model):
    name = models.CharField(max_length=200)
    capital = models.CharField(max_length=200)
    area = models.IntegerField()

{{python21="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

[ { "model": "nations.country", "pk": 1,  "fields": { "name": "United States", "capital": "Washington D.C.", "area": 9833520 } }, { "model": "nations.country", "pk": 2, "fields": { "name": "Mexico", "capital": "Mexico City", "area": 1964375 } }, { "model": "nations.country", "pk": 3, "fields": { "name": "Canada", "capital": "Ottawa", "area": 9984670 } }]

{{python22="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

from rest_framework import serializers
from .models import Country

class CountrySerializer(serializers.ModelSerializer):
    class Meta:
        model = Country
        fields = ('name', 'capital', 'area')

{{python23="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

from rest_framework import viewsets
from .serializers import CountrySerializer
from .models import Country

class CountryViewSet(viewsets.ModelViewSet):
    serializer_class = CountrySerializer
    queryset = Country.objects.all()

{{python24="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

from django.urls import include, path
from rest_framework import routers
from . import views

router = routers.DefaultRouter()
router.register('countries', views.CountryViewSet)

urlpatterns = [
    path('', include(router.urls)),
]

{{python25="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

urlpatterns = [    path('admin/', admin.site.urls),]

with this code:

from django.contrib import admin
from django.urls import include, path

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/', include('nations.urls')),
]

{{python26="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

[  { "name": "United States", "capital": "Washington D.C.", "area": 9833520},  {        "name": "Mexico","capital": "Mexico City", "area": 1964375 }, { "name": "Canada",        "capital": "Ottawa", "area": 9984670}]

{{python27="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

/api/countries/: a list view that allows you to retrieve a list of all countries in the database.
/api/countries/1/: a detail view that allows you to retrieve a specific country by its primary key.
/api/countries/1/update/: an update view that allows you to update a specific country.
/api/countries/create/: a create view that allows you to create a new country.

{{python28="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

from flask import Flask

app = Flask(__name__)

@app.route('/')

def hello():
    return 'Hello, World!'

if __name__ == '__main__':
    app.run()

{{python29="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

@app.route('/countries')
def list_countries():
    countries = [
        {'name': 'United States', 'capital': 'Washington D.C.', 'area': 9833520},
        {'name': 'Mexico', 'capital': 'Mexico City', 'area': 1964375},
        {'name': 'Canada', 'capital': 'Ottawa', 'area': 9984670},
    ]
    return {'countries': countries}

{{python30="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

# app.py
from fastapi import FastAPI
from pydantic import BaseModel, Field

def _find_next_id():
    return max(country.country_id for country in countries) + 1

class Country(BaseModel):
    country_id: int = Field(default_factory=_find_next_id, alias="id")
    name: str
    capital: str
    area: int

countries = [
    Country(id=1, name="Thailand", capital="Bangkok", area=513120),
    Country(id=2, name="Australia", capital="Canberra", area=7617930),
    Country(id=3, name="Egypt", capital="Cairo", area=1010408),
]

@app.get("/countries")
async def get_countries():
    return countries

@app.post("/countries", status_code=201)
async def add_country(country: Country):
    countries.append(country)
    return country

{{python31="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

from fastapi import FastAPI

app = FastAPI()

@app.get("/nations")
def read_nations():
    return [{'name': 'United States', 'capital': 'Washington D.C.', 'area': 914749.09},
            {'name': 'Russia', 'capital': 'Moscow', 'area': 17075400.0},
            {'name': 'China', 'capital': 'Beijing', 'area': 9596961.0}]

{{python32="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

@app.post("/countries")
def create_country(country: Country):
    return {'name': country.name, 'capital': country.capital, 'area': country.area}

{{python33="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

@app.get("/countries")
def read_countries():
    return countries

{{python34="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

from fastapi import FastAPI, BaseModel

class Country(BaseModel):
    name: str
    capital: str
    area: float

{{python35="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

class Country(BaseModel):
    id: int = Field(..., alias="id")

{{python36="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

data = {'title': 'My New Post', 'body': 'This is the body of my new post', 'userId': 1}
response = requests.post('https://jsonplaceholder.typicode.com/posts', json=data)

if response.status_code == 201:
    # Successful request
    post = response.json()
    print(post)
else:
    # Request failed
    print('Request failed with status code', response.status_code)

{{python37="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

response = requests.get('https://jsonplaceholder.typicode.com/posts')

if response.status_code == 200:
    # Successful request
    post = response.json()
    print(post)
else:
    # Request failed
    print('Request failed with status code', response.status_code)

{{python38="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

params = {'userId': 1}response = requests.get('https://jsonplaceholder.typicode.com/posts', params=params)

if response.status_code == 200:
    # Successful request
    posts = response.json()
    print(posts)
else:    # Request failed
    print('Request failed with status code', response.status_code)

{{python39="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

data = {'title': 'My New Post', 'body': 'This is the body of my new post', 'userId': 1}
response = requests.post('https://jsonplaceholder.typicode.com/posts', json=data)

if response.status_code == 201:
    # Successful request
    post = response.json()
    print(post)else:
    # Request failed
    print('Request failed with status code', response.status_code)

{{python40="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

data = {'title': 'Updated Title', 'body': 'Updated body', 'userId': 1}
response = requests.put('https://jsonplaceholder.typicode.com/posts/1', json=data)

if response.status_code == 200:
    # Successful request
    post = response.json()
    print(post)else:
    # Request failed
    print('Request failed with status code', response.status_code)

{{python41="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

response = requests.get('https://jsonplaceholder.typicode.com/posts')

if response.status_code == 200:
    # Successful request
    headers = response.headers
    print(headers)
else
    # Request failed
    print('Request failed with status code', response.status_code)

{{python42="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests
from base64 import b64encode

# Set the username and password
username = 'user'
password = 'pass'

# Encode the credentials
credentials = b64encode(f'{username}:{password}'.encode('utf-8')).decode('utf-8')

# Set the `Authorization` header
headers = {'Authorization': f'Basic {credentials}'}

# Send the request
response = requests.get('https://example.com/api/protected', headers=headers)

{{python43="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

# Set the token
token = 'your-token-here'

# Set the `Authorization` header
headers = {'Authorization': f'Token {token}'}

# Send the request
response = requests.get('https://example.com/api/protected', headers=headers)

{{python44="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

# Set the access token
access_token = 'your-access-token-here'

# Set the `Authorization` header
headers = {'Authorization': f'Bearer {access_token}'}

# Send the request
response = requests.get('https://example.com/api/protected', headers=headers)

{{python45="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests

# Obtain an access token using the OAuth2 flow

# Set the access token
access_token = 'your-access-token-here'

# Create a session
session = requests.Session()

# Set the `Authorization` header in the session
session.headers.update({'Authorization': f'Bearer {access_token}'})

# Send a request using the sessionresponse = session.get('https://example.com/api/protected')

{{python46="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests
try:
    response = requests.get('http://www.example.com')
    response.raise_for_status()
except requests.exceptions.HTTPError as err:
    print(err)

{{python47="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import requests
response = requests.get('http://www.example.com')

if response.status_code >= 400:
    print("An error occurred:", response.status_code)

{{python48="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

try:
    response = requests.get('http://api.open-notify.org/astros.json')
    response.raise_for_status()
    # Code here will only run if the request is successful
except requests.exceptions.TooManyRedirects as error:
    print(error).

You may specify the maximum number of redirects using the request options:

response = requests.get('http://api.open-notify.org/astros.json', max_redirects=2)

Alternatively, you may deactivate redirecting entirely in your request options:

response = requests.get('http://api.open-notify.org/astros.json', allow_redirects=False)

{{python49="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

try:
    response = requests.get('http://api.open-notify.org/astros.json')
     # Code here will only run if the request is successful
except requests.ConnectionError as error:
    print(error)

{{python50="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

try:
    response = requests.get('http://api.open-notify.org/astros.json', timeout=0.00001)
# Code here will only run if the request is successful
except requests. Timeout as error:
    print(error)

{{python51="/components"}}
https://www.boltic.io/blog/python-rest-api
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import pyodbc

# Connect to the database using a DSN
cnxn =
‍pyodbc.connect("DSN=mydsn;UID=myusername;PWD=mypassword")

# Create a cursor
cursor = cnxn.cursor()

# Execute a query
cursor.execute("SELECT * FROM mytable")

# Fetch the results
results = cursor.fetchall()

# Iterate over the results and print each row
for row in results:    print(row)

# Close the cursor and connection
cursor.close()
cnxn.close()

{{sqldata1="/components"}}
Python to the SQL Server database
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import pyodbc

# Connect to the database using a driver
cnxn = pyodbc.connect("DRIVER={ODBC Driver 17 for SQL Server};SERVER=my server;DATABASE=mydatabase;UID=myusername;PWD=mypassword")

{{sqldata2="/components"}}
Python to the SQL Server database
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

pip install pyodbc

{{sqldata3="/components"}}
Python to the SQL Server database
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import pyodbc

{{sqldata4="/components"}}
Python to the SQL Server database
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

cnxn = pyodbc.connect("DSN=mydsn;UID=myusername;PWD=mypassword")

{{sqldata5="/components"}}
Python to the SQL Server database
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

cursor = cnxn.cursor()

{{sqldata6="/components"}}
Python to the SQL Server database
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

# Execute a query
cursor.execute("SELECT * FROM mytable")

# Fetch the results
results = cursor.fetchall()

# Iterate over the results and print each row
for row in results:
    print(row)

{{sqldata7="/components"}}
Python to the SQL Server database
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

# Close the cursor and connection
cursor.close()
cnxn.close()

{{sqldata8="/components"}}
Python to the SQL Server database
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

import pyodbc

# Connect to the database using a DSN
cnxn = pyodbc.connect("DSN=mydsn;UID=myusername;PWD=mypassword")

# Create a cursor
cursor = cnxn.cursor()

# Execute a query
cursor.execute("SELECT * FROM mytable")

# Fetch the results
results = cursor.fetchall()

# Iterate over the results and print each row
for row in results:
    print(row)
pyodbc sql server

# Close the cursor and connection
cursor.close()
cnxn.close()

{{sqldata9="/components"}}
Python to the SQL Server database
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api
{{button="/components"}}
https://www.boltic.io/blog/what-is-chatgpt
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

Specify the --read-from-remote-server option.

--host: Specify the DNS name from the instance's endpoint.

--port: Specify the port used by the instance.

--user: Specify a MySQL user that has been granted the replication slave permission.

--password: Specify the password for the user, or omit a password value so that the utility prompts you for a password.

To download the file in binary format, specify the --raw option.

--result-file: Specify the local file to receive the raw output.

{{bb1="/components"}}
Topic Name: What is MySQL BinLog
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

mysqlbinlog \

    --read-from-remote-server \

    --host=MySQL56Instance1.cg034hpkmmjt.region.rds.amazonaws.com \

    --port=3306  \

    --user ReplUser \

    --password \

    --raw \

    --result-file=/tmp/ \

    Binlog.00098

{{bb2="/components"}}
Topic Name: What is MySQL BinLog
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

mysqlbinlog ^

    --read-from-remote-server ^

    --host=MySQL56Instance1.cg034hpkmmjt.region.rds.amazonaws.com ^

    --port=3306  ^

    --user ReplUser ^

    --password ^

    --raw ^

    --result-file=/tmp/ ^

    Binlog.00098

{{bb3="/components"}}
Topic Name: What is MySQL BinLog
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api

log-bin = /var/lib/mysql/mysql-bin

expire_logs_days = 2

binlog_format=mixed

Alternatively, you can set the "log-bin" variable to a specific file path, such as:

log-bin = /var/lib/mysql/-mysql-bin.log

Once you have made the necessary changes to the configuration file, you can restart the MySQL server to apply the changes.

To verify that BinLogs is enabled, you can use the "SHOW VARIABLES LIKE 'log_bin'" command. If the value of the "log_bin" variable is "ON," it indicates that BinLogs is enabled. If the value is "OFF," you can use the "SET GLOBAL log_bin = ON" command to enable BinLogs.

{{bb4="/components"}}
Topic Name: What is MySQL BinLog
Content Writer
HTTP Method
API Endpoint
Description
GET
/events/<event_id>/guests
Get a list of guests.
GET
/events/<event_id>/guests
Get a single guest.
POST
/events/<event_id>/guests
Create a new guest.
PUT
/events/<event_id>/guests
Update a guest.
PATCH
/events/<event_id>/guests/<guest_id>
Partially update a guest.
DELETE
/events/<event_id>/guests/<guest_id>
Delete a guest.
{{invisible2="/components"}}
https://www.boltic.io/blog/python-rest-api