Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ canonicalUrl: https://docs.strapi.io/developer-docs/latest/developer-resources/c

!!!include(developer-docs/latest/developer-resources/content-api/snippets/integration-guide-not-updated.md)!!!

This integration guide is following the [Quick Start Guide](/developer-docs/latest/getting-started/quick-start.md). We assume that you have fully completed its "Hands-on" path, and therefore can consume the API by browsing this [url](http://localhost:1337/restaurants).
This integration guide is following the [Quick Start Guide](/developer-docs/latest/getting-started/quick-start.md). We assume that you have fully completed its "Hands-on" path, and therefore can consume the API by browsing this [url](http://localhost:1337/api/restaurants).

If you haven't gone through the Quick Start Guide, the way you request a Strapi API with [11ty](https://www.11ty.dev/) remains the same except that you will not fetch the same content.

Expand Down Expand Up @@ -139,7 +139,7 @@ const { default: axios } = require('axios');

module.exports = async () => {
try {
const res = await axios.get('http://localhost:1337/restaurants');
const res = await axios.get('http://localhost:1337/api/restaurants');
return res.data;
} catch (error) {
console.error(error);
Expand Down Expand Up @@ -195,7 +195,7 @@ const { default: axios } = require('axios');

module.exports = async () => {
try {
const res = await axios.get('http://localhost:1337/restaurants');
const res = await axios.get('http://localhost:1337/api/restaurants');
return res.data;
} catch (error) {
console.error(error);
Expand Down Expand Up @@ -261,7 +261,7 @@ const { default: axios } = require('axios');

module.exports = async () => {
try {
const res = await axios.get('http://localhost:1337/categories');
const res = await axios.get('http://localhost:1337/api/categories');
return res.data;
} catch (error) {
console.error(error);
Expand Down Expand Up @@ -328,7 +328,7 @@ const { default: axios } = require('axios');

module.exports = async () => {
try {
const res = await axios.get('http://localhost:1337/categories');
const res = await axios.get('http://localhost:1337/api/categories');
return res.data;
} catch (error) {
console.error(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ canonicalUrl: https://docs.strapi.io/developer-docs/latest/developer-resources/c

!!!include(developer-docs/latest/developer-resources/content-api/snippets/integration-guide-not-updated.md)!!!

This integration guide is following the [Quick Start Guide](/developer-docs/latest/getting-started/quick-start.md). We assume that you have fully completed its "Hands-on" path, and therefore can consume the API by browsing this [url](http://localhost:1337/restaurants).
This integration guide is following the [Quick Start Guide](/developer-docs/latest/getting-started/quick-start.md). We assume that you have fully completed its "Hands-on" path, and therefore can consume the API by browsing this [url](http://localhost:1337/api/restaurants).

If you haven't gone through the Quick Start Guide, the way you request a Strapi API with [Angular](https://angular.io) remains the same except that you will not fetch the same content.

Expand Down Expand Up @@ -56,7 +56,7 @@ Be sure that you activated the `find` permission for the `restaurant` Collection
```js
import axios from 'axios';

axios.get('http://localhost:1337/restaurants').then(response => {
axios.get('http://localhost:1337/api/restaurants').then(response => {
console.log(response);
});
```
Expand All @@ -68,7 +68,7 @@ axios.get('http://localhost:1337/restaurants').then(response => {

::: request Example GET request with fetch
```js
fetch('http://localhost:1337/restaurants', {
fetch('http://localhost:1337/api/restaurants', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -142,7 +142,7 @@ export class AppComponent implements OnInit {

async ngOnInit() {
try {
const response = await axios.get('http://localhost:1337/restaurants');
const response = await axios.get('http://localhost:1337/api/restaurants');
this.restaurants = response.data;
} catch (error) {
this.error = error;
Expand Down Expand Up @@ -187,7 +187,7 @@ export class AppComponent implements OnInit {

async ngOnInit() {
try {
const restaurants = await fetch('http://localhost:1337/restaurants', {
const restaurants = await fetch('http://localhost:1337/api/restaurants', {
method: 'GET',
headers: headers,
})
Expand Down Expand Up @@ -234,7 +234,7 @@ In this example a `japanese` category has been created which has the id: 3.
import axios from 'axios';

axios
.post('http://localhost:1337/restaurants', {
.post('http://localhost:1337/api/restaurants', {
name: 'Dolemon Sushi',
description: 'Unmissable Japanese Sushi restaurant. The cheese and salmon makis are delicious',
categories: [3],
Expand All @@ -251,7 +251,7 @@ axios

::: request Example POST request with fetch
```js
fetch('http://localhost:1337/restaurants', {
fetch('http://localhost:1337/api/restaurants', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -370,7 +370,7 @@ export class AppComponent implements OnInit {

async ngOnInit() {
try {
const response = await axios.get('http://localhost:1337/categories');
const response = await axios.get('http://localhost:1337/api/categories');
this.allCategories = response.data
} catch (error) {
this.error = error
Expand All @@ -381,7 +381,7 @@ export class AppComponent implements OnInit {
async onSubmit(restaurantData) {
try {
const response = await axios.post(
'http://localhost:1337/restaurants',
'http://localhost:1337/api/restaurants',
restaurantData
);
console.log(response);
Expand Down Expand Up @@ -463,7 +463,7 @@ export class AppComponent implements OnInit {

async ngOnInit() {
try {
const allCategories = await fetch('http://localhost:1337/categories', {
const allCategories = await fetch('http://localhost:1337/api/categories', {
method: 'GET',
headers: headers,
})
Expand All @@ -478,7 +478,7 @@ export class AppComponent implements OnInit {

async onSubmit(restaurantData) {
try {
await fetch('http://localhost:1337/restaurants', {
await fetch('http://localhost:1337/api/restaurants', {
method: 'POST',
headers: headers,
body: JSON.stringify(restaurantData),
Expand Down Expand Up @@ -550,7 +550,7 @@ and the id of your category is `2`.
import axios from 'axios';

axios
.put('http://localhost:1337/restaurants/2', {
.put('http://localhost:1337/api/restaurants/2', {
categories: [2],
})
.then(response => {
Expand All @@ -565,7 +565,7 @@ axios
::: request Example PUT request with fetch

```js
fetch('http://localhost:1337/restaurants/2', {
fetch('http://localhost:1337/api/restaurants/2', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ canonicalUrl: https://docs.strapi.io/developer-docs/latest/developer-resources/c

!!!include(developer-docs/latest/developer-resources/content-api/snippets/integration-guide-not-updated.md)!!!

This integration guide is following the [Quick Start Guide](/developer-docs/latest/getting-started/quick-start.md). We assume that you have fully completed its "Hands-on" path, and therefore can consume the API by browsing this [url](http://localhost:1337/restaurants).
This integration guide is following the [Quick Start Guide](/developer-docs/latest/getting-started/quick-start.md). We assume that you have fully completed its "Hands-on" path, and therefore can consume the API by browsing this [url](http://localhost:1337/api/restaurants).

If you haven't gone through the Quick Start guide, the way you request a Strapi API with [GO](https://golang.org/) remains the same except that you will not fetch the same content.

Expand All @@ -35,7 +35,7 @@ Be sure that you activated the `find` permission for the `restaurant` Collection
::: request Example GET request

```go
response, error := http.Get("http://localhost:1337/restaurants")
response, error := http.Get("http://localhost:1337/api/restaurants")
```
:::

Expand Down Expand Up @@ -87,7 +87,7 @@ func main() {

func getD() {
fmt.Println("Getting data...")
res, error := http.Get("http://localhost:1337/restaurants")
res, error := http.Get("http://localhost:1337/api/restaurants")
if error != nil {
fmt.Printf("The HTTP request failed with error %s\n", error)
} else {
Expand All @@ -111,7 +111,7 @@ postRest, _ := json.Marshal(map[string]string{
"description": "This is a very nice place to eat native soup",
})
responseBody := bytes.NewBuffer(postRest)
resp, error := http.Post("http://localhost:1337/restaurants", "application/json", responseBody)
resp, error := http.Post("http://localhost:1337/api/restaurants", "application/json", responseBody)
```
:::

Expand Down Expand Up @@ -150,7 +150,7 @@ func main() {

func getD() {
fmt.Println("Getting data...")
resp, error := http.Get("http://localhost:1337/restaurants")
resp, error := http.Get("http://localhost:1337/api/restaurants")
if error != nil {
fmt.Printf("The HTTP request failed with error %s\n", error)
} else {
Expand All @@ -167,7 +167,7 @@ func postD() {
"description": "This is a very nice place to eat native soup",
})
responseBody := bytes.NewBuffer(postRest)
resp, error := http.Post("http://localhost:1337/restaurants", "application/json", responseBody)
resp, error := http.Post("http://localhost:1337/api/restaurants", "application/json", responseBody)
//Handle Error
if error != nil {
log.Fatalf("An Error Occured %v", error)
Expand All @@ -188,7 +188,7 @@ func postD() {
Execute a `PUT` request on the `restaurant` Collection Type in order to update the category of a restaurant.

Be sure that you activated the `update` permission for the `restaurant` Collection Type.
PUT Request is sligtly different as we need to target the particular thing we want update. We do this by first making a request to http://localhost:1337/restaurants/1 and then update what we want to update. In this example, we are going to update "Biscotte Restaurant" to "Restaurant Home".
PUT Request is sligtly different as we need to target the particular thing we want update. We do this by first making a request to http://localhost:1337/api/restaurants/1 and then update what we want to update. In this example, we are going to update "Biscotte Restaurant" to "Restaurant Home".

:::: api-call
::: request Example PUT request
Expand All @@ -198,7 +198,7 @@ putRest, _ := json.Marshal(map[string]string {
"name": "Resturant Homes",
})
client := &http.Client{}
url := "http://localhost:1337/restaurants/1"
url := "http://localhost:1337/api/restaurants/1"
req, error := http.NewRequest(http.MethodPut, url, bytes.NewBuffer(putRest))
req.Header.Set("Content-Type", "application/json")
```
Expand Down Expand Up @@ -256,7 +256,7 @@ func main() {
}
func getD() {
fmt.Println("Getting data...")
resp, error := http.Get("http://localhost:1337/restaurants")
resp, error := http.Get("http://localhost:1337/api/restaurants")
if error != nil {
fmt.Printf("The HTTP request failed with error %s\n", error)
} else {
Expand All @@ -274,7 +274,7 @@ func postD() {
})

responseBody := bytes.NewBuffer(postRest)
resp, error := http.Post("http://localhost:1337/restaurants", "application/json", responseBody)
resp, error := http.Post("http://localhost:1337/api/restaurants", "application/json", responseBody)
// Handle Error
if error != nil {
log.Fatalf("An Error Occured %v", error)
Expand All @@ -293,7 +293,7 @@ func putD() {
"name": "Resturant Homes",
})
client := &http.Client{}
url := "http://localhost:1337/restaurants/1"
url := "http://localhost:1337/api/restaurants/1"
req, error := http.NewRequest(http.MethodPut, url, bytes.NewBuffer(putRest))
req.Header.Set("Content-Type", "application/json")
if error != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ canonicalUrl: https://docs.strapi.io/developer-docs/latest/developer-resources/c

!!!include(developer-docs/latest/developer-resources/content-api/snippets/integration-guide-not-updated.md)!!!

This integration guide is following the [Quick Start Guide](/developer-docs/latest/getting-started/quick-start.md). We assume that you have fully completed its "Hands-on" path, and therefore can consume the API by browsing this [url](http://localhost:1337/restaurants).
This integration guide is following the [Quick Start Guide](/developer-docs/latest/getting-started/quick-start.md). We assume that you have fully completed its "Hands-on" path, and therefore can consume the API by browsing this [url](http://localhost:1337/api/restaurants).

If you haven't gone through the Quick Start Guide, the way you request a Strapi API with [Next.js](https://nextjs.org/) remains the same except that you will not fetch the same content.

Expand Down Expand Up @@ -67,7 +67,7 @@ Be sure that you activated the `find` permission for the `restaurant` Collection
```js
import axios from 'axios';

axios.get('http://localhost:1337/restaurants').then(response => {
axios.get('http://localhost:1337/api/restaurants').then(response => {
console.log(response);
});
```
Expand All @@ -79,7 +79,7 @@ axios.get('http://localhost:1337/restaurants').then(response => {
::: request Example GET request with fetch

```js
fetch('http://localhost:1337/restaurants', {
fetch('http://localhost:1337/api/restaurants', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -156,7 +156,7 @@ const Home = ({ restaurants, error }) => {

Home.getInitialProps = async ctx => {
try {
const res = await axios.get('http://localhost:1337/restaurants');
const res = await axios.get('http://localhost:1337/api/restaurants');
const restaurants = res.data;
return { restaurants };
} catch (error) {
Expand Down Expand Up @@ -205,7 +205,7 @@ Home.getInitialProps = async ctx => {
'Content-Type': 'application/json',
};

const restaurants = await fetch('http://localhost:1337/restaurants', {
const restaurants = await fetch('http://localhost:1337/api/restaurants', {
method: 'GET',
headers,
})
Expand Down Expand Up @@ -242,7 +242,7 @@ In this example a `japanese` category has been created which has the id: 3.
import axios from 'axios';

axios
.post('http://localhost:1337/restaurants', {
.post('http://localhost:1337/api/restaurants', {
name: 'Dolemon Sushi',
description: 'Unmissable Japanese Sushi restaurant. The cheese and salmon makis are delicious',
categories: [3],
Expand All @@ -258,7 +258,7 @@ axios
:::: tab fetch
::: request Example POST request with fetch
```js
fetch('http://localhost:1337/restaurants', {
fetch('http://localhost:1337/api/restaurants', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -333,7 +333,7 @@ const Home = ({ allCategories, errorCategories }) => {
e.preventDefault();

try {
const response = await axios.post('http://localhost:1337/restaurants', modifiedData);
const response = await axios.post('http://localhost:1337/api/restaurants', modifiedData);
console.log(response);
} catch (error) {
setErrorRestaurants(error);
Expand Down Expand Up @@ -404,7 +404,7 @@ const Home = ({ allCategories, errorCategories }) => {

Home.getInitialProps = async ctx => {
try {
const res = await axios.get('http://localhost:1337/categories');
const res = await axios.get('http://localhost:1337/api/categories');
const allCategories = res.data;
return { allCategories };
} catch (errorCategories) {
Expand Down Expand Up @@ -458,7 +458,7 @@ const Home = ({ allCategories, errorCategories }) => {
e.preventDefault();

try {
const response = await fetch('http://localhost:1337/restaurants', {
const response = await fetch('http://localhost:1337/api/restaurants', {
method: 'POST',
headers,
body: JSON.stringify(modifiedData),
Expand Down Expand Up @@ -536,7 +536,7 @@ const Home = ({ allCategories, errorCategories }) => {

Home.getInitialProps = async ctx => {
try {
const allCategories = await fetch('http://localhost:1337/categories', {
const allCategories = await fetch('http://localhost:1337/api/categories', {
method: 'GET',
headers,
})
Expand Down Expand Up @@ -572,7 +572,7 @@ and the id of your category is `2`.
import axios from 'axios';

axios
.put('http://localhost:1337/restaurants/2', {
.put('http://localhost:1337/api/restaurants/2', {
categories: [2],
})
.then(response => {
Expand All @@ -586,7 +586,7 @@ axios
:::: tab fetch
::: request Example PUT request with fetch
```js
fetch('http://localhost:1337/restaurants/2', {
fetch('http://localhost:1337/api/restaurants/2', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
Expand Down
Loading