RESTful API

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

19 Terms

1
New cards

RESTful API (Representational State Transfer API)

an architectural style for designing networked applications

  • stateless - no client context is stored on the server

  • the client and server are independent

  • URLs represent resources, not actions

  • relies on HTTP methods

  • uses HTTP status codes


2
New cards

HTTP methods

  • GET

  • PUT

  • POST

  • DELETE


3
New cards

GET (HTTP method)

retrieve data

4
New cards

PUT (HTTP method)

update resource

5
New cards

POST (HTTP method)

create new resource

6
New cards

DELETE (HTTP method)

remove resources

7
New cards

HTTP status codes

  • 200 OK

  • 201 Created

  • 400 Bad Request

  • 404 Not Found

  • 500 Internal Sever Error


8
New cards

200 OK (HTTP status code)

Success

9
New cards

201 Created (HTTP status code)

new resource created

10
New cards

400 Bad Request (HTTP status code)

client-side error

11
New cards

404 Not Found (HTTP status code)

resource does not exist

12
New cards

500 Internal Server Error (HTTP status code)

server-side error

13
New cards

Flask

lightweight, open-source Python web microframework used to build web applications and RESTful APIs quickly without forcing a rigid project structure or built-in database layer

14
New cards

How can you build a RESTful API in Python?

using native Flask with native functions and jsonify

15
New cards

pros of building RESTful API in Python

  • easy to use

  • flexible and customizable

  • good for small to medium-sized applications

  • great for rapid prototyping and development


16
New cards

cons of building RESTful API in Python

  • not suitable for large-scale applications

  • limited functionality compared to other frameworks

  • requires additional setup for larger applications


17
New cards

app = Flask(__name__)

creates Flask application

18
New cards

CORS(app)

used for JavaScript operations

19
New cards

Postman

used to test the API during development to ensure it functions correctly and behaves as expected in various situations