Restful API Design - Microsoft Flashcards

(8 cards)

1
Q

Microsoft Link

A

https://learn.microsoft.com/en-us/azure/architecture/best-practices/api-design#define-restful-web-api-methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

/customers

A

{POST:Create a new customer,GET:Retrieve all customers, PUT Bulk update of customers, DELETE Remove all customers}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

/customers/1

A

{POST:Error,GET:Retrieve the details for customer 1, PUT Update the details of customer 1 if it exists, DELETE Remove customer 1}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

/customers/1/orders

A

{POST:Create a new order for customer 1,GET:Retrieve all orders for customer 1, PUT Bulk update of orders for customer 1, DELETE Remove all orders for customer 1}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

When to use Path Params

A

Path Params
Use when: identifying a specific resource.
GET /users/123/orders/456 - Meaning: get order 456 for user 123

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When to use Query Params

A

Query Parameters (?key=value)
Use when: you want to filter, search, or modify how data is retrieved (but not identify which data).
Filtering (?status=active)
Pagination (?page=3&limit=20)
Sorting (?sort=name)
Searching (?q=concert)

Do not send sensitive data in this

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Request Body

A

Use when: sending data to create or update a resource.
POST /events
Content-Type: application/json

{
“name”: “Coldplay Concert”,
“date”: “2025-12-10”,
“venue”: “London Arena”
}
Good for - POST, PUT, PATCH requests. Complex or structured data (JSON, XML, etc.)

Do not use in GET - Browsers may ignore it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Headers

A

Use when: sending metadata about the request, not the resource data itself.
Authentication (Authorization)
Content type (Content-Type, Accept)
Custom client info (X-Client-Version, etc.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly