Skip to content

Add new Address API documentation #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions docusaurus/docs/cms/api/rest.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
---
---
title: REST API reference
description: Interact with your Content-Types using the REST API endpoints Strapi generates for you.
description: >-
Interact with your Content-Types using the REST API endpoints Strapi generates
for you.
displayed_sidebar: cmsSidebar
tags:
- API
- Content API
- documentId
- Documents
- plural API ID
- REST API
- singular API ID
- API
- Content API
- documentId
- Documents
- plural API ID
- REST API
- singular API ID
---

# REST API reference
Expand Down
178 changes: 178 additions & 0 deletions docusaurus/docs/cms/api/rest/address-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
---
title: Address API Endpoints
description: Learn how to use the REST API endpoints for the Address content-type.
displayed_sidebar: cmsSidebar
tags:
- API
- Content API
- REST API
- address
---

# Address API Endpoints

This page provides information on how to interact with the Address content-type using the REST API endpoints.

## Endpoints

The following endpoints are available for the Address content-type:

| Method | URL | Description |
| -------- | ------------------------ | -------------------------- |
| `GET` | `/api/addresses` | Get a list of addresses |
| `POST` | `/api/addresses` | Create a new address |
| `GET` | `/api/addresses/:documentId` | Get a specific address |
| `PUT` | `/api/addresses/:documentId` | Update an address |
| `DELETE` | `/api/addresses/:documentId` | Delete an address |

## Get a list of addresses

Returns a list of addresses based on query parameters.

### Request

```http
GET /api/addresses
```

### Response

```json
{
"data": [
{
"documentId": "abc123",
"postal_code": "12",
"city": "New York",
"createdAt": "2024-03-06T14:16:56.883Z",
"updatedAt": "2024-03-06T14:16:56.883Z",
"publishedAt": "2024-03-06T14:16:56.895Z"
},
// ... more addresses
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 1,
"total": 2
}
}
}
```

## Get a specific address

Returns a single address by its `documentId`.

### Request

```http
GET /api/addresses/:documentId
```

### Response

```json
{
"data": {
"documentId": "abc123",
"postal_code": "12",
"city": "New York",
"createdAt": "2024-03-06T14:16:56.883Z",
"updatedAt": "2024-03-06T14:16:56.883Z",
"publishedAt": "2024-03-06T14:16:56.895Z"
},
"meta": {}
}
```

## Create a new address

Creates a new address and returns its value.

### Request

```http
POST /api/addresses
```

```json
{
"data": {
"postal_code": "12",
"city": "New York"
}
}
```

### Response

```json
{
"data": {
"documentId": "def456",
"postal_code": "12",
"city": "New York",
"createdAt": "2024-03-06T15:30:00.000Z",
"updatedAt": "2024-03-06T15:30:00.000Z",
"publishedAt": "2024-03-06T15:30:00.000Z"
},
"meta": {}
}
```

## Update an address

Updates an address by its `documentId` and returns its value.

### Request

```http
PUT /api/addresses/:documentId
```

```json
{
"data": {
"city": "Los Angeles"
}
}
```

### Response

```json
{
"data": {
"documentId": "abc123",
"postal_code": "12",
"city": "Los Angeles",
"createdAt": "2024-03-06T14:16:56.883Z",
"updatedAt": "2024-03-06T15:45:00.000Z",
"publishedAt": "2024-03-06T14:16:56.895Z"
},
"meta": {}
}
```

## Delete an address

Deletes an address by its `documentId`.

### Request

```http
DELETE /api/addresses/:documentId
```

### Response

The server will respond with a 204 No Content status upon successful deletion.

## Additional Notes

- The `postal_code` field is limited to a maximum of 2 characters.
- The `city` field is required and has a maximum length of 200 characters.
- The Address content-type includes other fields like `categories`, `cover`, `images`, `json`, `slug`, and some component fields. These can be populated or filtered as needed using the appropriate query parameters.
- For more information on querying, filtering, and pagination, refer to the [REST API parameters](/cms/api/rest/parameters) documentation.