diff --git a/docs/developer-docs/latest/developer-resources/content-api/integrations/11ty.md b/docs/developer-docs/latest/developer-resources/content-api/integrations/11ty.md index 0956ba0b87..ed0a771722 100644 --- a/docs/developer-docs/latest/developer-resources/content-api/integrations/11ty.md +++ b/docs/developer-docs/latest/developer-resources/content-api/integrations/11ty.md @@ -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. @@ -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); @@ -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); @@ -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); @@ -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); diff --git a/docs/developer-docs/latest/developer-resources/content-api/integrations/angular.md b/docs/developer-docs/latest/developer-resources/content-api/integrations/angular.md index 4e498cb90e..36652955f2 100644 --- a/docs/developer-docs/latest/developer-resources/content-api/integrations/angular.md +++ b/docs/developer-docs/latest/developer-resources/content-api/integrations/angular.md @@ -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. @@ -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); }); ``` @@ -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', @@ -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; @@ -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, }) @@ -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], @@ -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', @@ -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 @@ -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); @@ -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, }) @@ -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), @@ -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 => { @@ -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', diff --git a/docs/developer-docs/latest/developer-resources/content-api/integrations/go.md b/docs/developer-docs/latest/developer-resources/content-api/integrations/go.md index 71161d25fd..ba585cfc70 100644 --- a/docs/developer-docs/latest/developer-resources/content-api/integrations/go.md +++ b/docs/developer-docs/latest/developer-resources/content-api/integrations/go.md @@ -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. @@ -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") ``` ::: @@ -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 { @@ -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) ``` ::: @@ -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 { @@ -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) @@ -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 @@ -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") ``` @@ -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 { @@ -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) @@ -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 { diff --git a/docs/developer-docs/latest/developer-resources/content-api/integrations/next-js.md b/docs/developer-docs/latest/developer-resources/content-api/integrations/next-js.md index 39da8dec14..59cc90861b 100644 --- a/docs/developer-docs/latest/developer-resources/content-api/integrations/next-js.md +++ b/docs/developer-docs/latest/developer-resources/content-api/integrations/next-js.md @@ -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. @@ -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); }); ``` @@ -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', @@ -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) { @@ -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, }) @@ -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], @@ -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', @@ -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); @@ -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) { @@ -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), @@ -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, }) @@ -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 => { @@ -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', diff --git a/docs/developer-docs/latest/developer-resources/content-api/integrations/nuxt-js.md b/docs/developer-docs/latest/developer-resources/content-api/integrations/nuxt-js.md index 33afacfc16..dc4b78d892 100644 --- a/docs/developer-docs/latest/developer-resources/content-api/integrations/nuxt-js.md +++ b/docs/developer-docs/latest/developer-resources/content-api/integrations/nuxt-js.md @@ -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 [Nuxt.js](https://nuxtjs.org/) remains the same except that you will not fetch the same content. @@ -102,7 +102,7 @@ try { ```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); }); ``` @@ -114,7 +114,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', @@ -240,7 +240,7 @@ export default { }, async mounted () { 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; @@ -296,7 +296,7 @@ export default { }, async mounted () { try { - const response = await fetch("http://localhost:1337/restaurants", { + const response = await fetch("http://localhost:1337/api/restaurants", { method: 'GET', headers: this.headers, }).then(this.checkStatus) @@ -349,7 +349,7 @@ try { 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], @@ -365,7 +365,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', @@ -551,7 +551,7 @@ export default { }, async mounted() { 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; @@ -562,7 +562,7 @@ export default { e.preventDefault(); try { - const response = await axios.post('http://localhost:1337/restaurants', this.modifiedData) + const response = await axios.post('http://localhost:1337/api/restaurants', this.modifiedData) console.log(response); } catch(error) { this.error = error; @@ -635,7 +635,7 @@ export default { }, async mounted() { try { - const allCategories = await fetch("http://localhost:1337/categories", { + const allCategories = await fetch("http://localhost:1337/api/categories", { method: 'GET', headers: this.headers, }).then(this.checkStatus) @@ -661,7 +661,7 @@ export default { e.preventDefault(); try { - const response = await fetch('http://localhost:1337/restaurants', { + const response = await fetch('http://localhost:1337/api/restaurants', { method: 'POST', headers: this.headers, body: JSON.stringify(this.modifiedData) @@ -714,7 +714,7 @@ try { import axios from 'axios'; axios - .put('http://localhost:1337/restaurants/2', { + .put('http://localhost:1337/api/restaurants/2', { categories: [2], }) .then(response => { @@ -728,7 +728,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', diff --git a/docs/developer-docs/latest/developer-resources/content-api/integrations/php.md b/docs/developer-docs/latest/developer-resources/content-api/integrations/php.md index 64890ee0a6..16664925a7 100644 --- a/docs/developer-docs/latest/developer-resources/content-api/integrations/php.md +++ b/docs/developer-docs/latest/developer-resources/content-api/integrations/php.md @@ -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 [PHP](https://php.net/) remains the same except that you will not fetch the same content. @@ -31,7 +31,7 @@ Be sure that you activated the `find` permission for the `restaurant` Collection ::: request Example GET request ```php -curl_setopt($curl, CURLOPT_URL, 'http://localhost:1337/restaurants'); +curl_setopt($curl, CURLOPT_URL, 'http://localhost:1337/api/restaurants'); ``` Running the PHP file on the browser will give you this response: @@ -72,7 +72,7 @@ Running the PHP file on the browser will give you this response: { +axios.get('http://localhost:1337/api/restaurants').then(response => { console.log(response); }); ``` @@ -81,7 +81,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', @@ -154,7 +154,7 @@ class App extends React.Component { // Fetch your restaurants immediately after the component is mounted componentDidMount = async () => { try { - const response = await axios.get('http://localhost:1337/restaurants'); + const response = await axios.get('http://localhost:1337/api/restaurants'); this.setState({ restaurants: response.data }); } catch (error) { this.setState({ error }); @@ -219,7 +219,7 @@ class App extends React.Component { }; try { - const restaurants = await fetch('http://localhost:1337/restaurants', { + const restaurants = await fetch('http://localhost:1337/api/restaurants', { method: 'GET', headers: headers, }) @@ -275,7 +275,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], @@ -292,7 +292,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', @@ -366,7 +366,7 @@ class App extends React.Component { // Fetch your categories immediately after the component is mounted componentDidMount = async () => { try { - const response = await axios.get('http://localhost:1337/categories'); + const response = await axios.get('http://localhost:1337/api/categories'); this.setState({ allCategories: response.data }); } catch (error) { this.setState({ error }); @@ -388,7 +388,7 @@ class App extends React.Component { try { const response = await axios.post( - 'http://localhost:1337/restaurants', + 'http://localhost:1337/api/restaurants', this.state.modifiedData ); console.log(response); @@ -519,7 +519,7 @@ class App extends React.Component { componentDidMount = async () => { try { - const allCategories = await fetch('http://localhost:1337/categories', { + const allCategories = await fetch('http://localhost:1337/api/categories', { method: 'GET', headers: headers, }) @@ -545,7 +545,7 @@ class App extends React.Component { e.preventDefault(); try { - await fetch('http://localhost:1337/restaurants', { + await fetch('http://localhost:1337/api/restaurants', { method: 'POST', headers: headers, body: JSON.stringify(this.state.modifiedData), @@ -660,7 +660,7 @@ We consider that the id of your restaurant is `2`, and the id of your category i import axios from 'axios'; axios - .put('http://localhost:1337/restaurants/2', { + .put('http://localhost:1337/api/restaurants/2', { categories: [2], }) .then(response => { @@ -675,7 +675,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', diff --git a/docs/developer-docs/latest/developer-resources/content-api/integrations/ruby.md b/docs/developer-docs/latest/developer-resources/content-api/integrations/ruby.md index e0e3f65df9..bcefffbaa7 100644 --- a/docs/developer-docs/latest/developer-resources/content-api/integrations/ruby.md +++ b/docs/developer-docs/latest/developer-resources/content-api/integrations/ruby.md @@ -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 [Ruby](https://www.ruby-lang.org/en/) remains the same except that you will not fetch the same content. @@ -49,7 +49,7 @@ Be sure that you activated the `find` permission for the `restaurant` Collection ::: request Example GET request ```ruby -HTTParty.get('http://localhost:1337/restaurants', +HTTParty.get('http://localhost:1337/api/restaurants', header: { 'Content-Type' => 'application/json' }) @@ -129,7 +129,7 @@ In this example a `japanese` category has been created which has the id: 3. ::: request Example POST request ```ruby -HTTParty.post("http://localhost:1337/restaurants", +HTTParty.post("http://localhost:1337/api/restaurants", body: { name: 'Dolemon Sushi', description: 'Unmissable Japanese Sushi restaurant. The cheese and salmon makis are delicious', @@ -218,7 +218,7 @@ Be sure that you activated the `put` permission for the `restaurant` Collection ::: request Example PUT request ```ruby -HTTParty.put("http://localhost:1337/restaurants/2", +HTTParty.put("http://localhost:1337/api/restaurants/2", body: { categories: [2] }, diff --git a/docs/developer-docs/latest/developer-resources/content-api/integrations/sapper.md b/docs/developer-docs/latest/developer-resources/content-api/integrations/sapper.md index 37dfc11601..4059bec61f 100644 --- a/docs/developer-docs/latest/developer-resources/content-api/integrations/sapper.md +++ b/docs/developer-docs/latest/developer-resources/content-api/integrations/sapper.md @@ -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 [Sapper](https://sapper.svelte.dev) remains the same except that you will not fetch the same content. @@ -61,7 +61,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); }); ``` @@ -74,7 +74,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', @@ -144,7 +144,7 @@ let error = null onMount(async () => { try { - const res = await axios.get('http://localhost:1337/restaurants'); + const res = await axios.get('http://localhost:1337/api/restaurants'); restaurants = res.data } catch (e) { error = e @@ -194,7 +194,7 @@ onMount(async () => { }; try { - const res = await fetch("http://localhost:1337/restaurants", { + const res = await fetch("http://localhost:1337/api/restaurants", { method: "GET", headers: { 'Content-Type': 'application/json' @@ -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], @@ -259,7 +259,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', @@ -325,7 +325,7 @@ let error = null; async function handleSubmit() { try { - const response = await axios.post('http://localhost:1337/restaurants', { + const response = await axios.post('http://localhost:1337/api/restaurants', { name: restaurantName, description: restaurantDescription, categories: restaurantCategories @@ -338,7 +338,7 @@ async function handleSubmit() { onMount(async () => { try { - const response = await axios.get('http://localhost:1337/categories'); + const response = await axios.get('http://localhost:1337/api/categories'); allCategories = response.data } catch(e) { error = e @@ -404,7 +404,7 @@ const headers = { async function handleSubmit() { try { - await fetch('http://localhost:1337/restaurants', { + await fetch('http://localhost:1337/api/restaurants', { method: "POST", headers: headers, body: JSON.stringify({ @@ -422,7 +422,7 @@ async function handleSubmit() { onMount(async () => { try { - const res = await fetch("http://localhost:1337/categories", { + const res = await fetch("http://localhost:1337/api/categories", { method: "GET", headers: headers, }).then(checkStatus) @@ -481,7 +481,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 => { @@ -497,7 +497,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', diff --git a/docs/developer-docs/latest/developer-resources/content-api/integrations/svelte.md b/docs/developer-docs/latest/developer-resources/content-api/integrations/svelte.md index ab7ad6f433..58aaebada1 100644 --- a/docs/developer-docs/latest/developer-resources/content-api/integrations/svelte.md +++ b/docs/developer-docs/latest/developer-resources/content-api/integrations/svelte.md @@ -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 [Svelte](https://svelte.dev) remains the same except that you will not fetch the same content. @@ -61,7 +61,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); }); ``` @@ -74,7 +74,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', @@ -142,7 +142,7 @@ let error = null onMount(async () => { try { - const res = await axios.get('http://localhost:1337/restaurants'); + const res = await axios.get('http://localhost:1337/api/restaurants'); restaurants = res.data } catch (e) { error = e @@ -192,7 +192,7 @@ onMount(async () => { }; try { - const res = await fetch("http://localhost:1337/restaurants", { + const res = await fetch("http://localhost:1337/api/restaurants", { method: "GET", headers: { 'Content-Type': 'application/json' @@ -241,7 +241,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], @@ -259,7 +259,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', @@ -325,7 +325,7 @@ let error = null; async function handleSubmit() { try { - const response = await axios.post('http://localhost:1337/restaurants', { + const response = await axios.post('http://localhost:1337/api/restaurants', { name: restaurantName, description: restaurantDescription, categories: restaurantCategories @@ -338,7 +338,7 @@ async function handleSubmit() { onMount(async () => { try { - const response = await axios.get('http://localhost:1337/categories'); + const response = await axios.get('http://localhost:1337/api/categories'); allCategories = response.data } catch(e) { error = e @@ -404,7 +404,7 @@ const headers = { async function handleSubmit() { try { - await fetch('http://localhost:1337/restaurants', { + await fetch('http://localhost:1337/api/restaurants', { method: "POST", headers: headers, body: JSON.stringify({ @@ -422,7 +422,7 @@ async function handleSubmit() { onMount(async () => { try { - const res = await fetch("http://localhost:1337/categories", { + const res = await fetch("http://localhost:1337/api/categories", { method: "GET", headers: headers, }).then(checkStatus) @@ -481,7 +481,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 => { @@ -497,7 +497,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', diff --git a/docs/developer-docs/latest/developer-resources/content-api/integrations/vue-js.md b/docs/developer-docs/latest/developer-resources/content-api/integrations/vue-js.md index 10b811caef..f4fa7d4d45 100644 --- a/docs/developer-docs/latest/developer-resources/content-api/integrations/vue-js.md +++ b/docs/developer-docs/latest/developer-resources/content-api/integrations/vue-js.md @@ -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 [Vue.js](https://vuejs.org/) remains the same except that you will not fetch the same content. @@ -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); }); ``` @@ -69,7 +69,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', @@ -154,7 +154,7 @@ export default { }, async mounted () { 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; @@ -210,7 +210,7 @@ export default { }, async mounted () { try { - const response = await fetch("http://localhost:1337/restaurants", { + const response = await fetch("http://localhost:1337/api/restaurants", { method: 'GET', headers: this.headers, }).then(this.checkStatus) @@ -246,7 +246,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], @@ -263,7 +263,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', @@ -367,7 +367,7 @@ export default { }, async mounted() { 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; @@ -378,7 +378,7 @@ export default { e.preventDefault(); try { - const response = await axios.post('http://localhost:1337/restaurants', this.modifiedData) + const response = await axios.post('http://localhost:1337/api/restaurants', this.modifiedData) console.log(response); } catch(error) { this.error = error; @@ -451,7 +451,7 @@ export default { }, async mounted() { try { - const allCategories = await fetch("http://localhost:1337/categories", { + const allCategories = await fetch("http://localhost:1337/api/categories", { method: 'GET', headers: this.headers, }).then(this.checkStatus) @@ -477,7 +477,7 @@ export default { e.preventDefault(); try { - const response = await fetch('http://localhost:1337/restaurants', { + const response = await fetch('http://localhost:1337/api/restaurants', { method: 'POST', headers: this.headers, body: JSON.stringify(this.modifiedData) @@ -516,7 +516,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 => { @@ -531,7 +531,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', diff --git a/docs/developer-docs/latest/developer-resources/plugin-api-reference/admin-panel.md b/docs/developer-docs/latest/developer-resources/plugin-api-reference/admin-panel.md index 5c800f4d1f..127bdd887a 100644 --- a/docs/developer-docs/latest/developer-resources/plugin-api-reference/admin-panel.md +++ b/docs/developer-docs/latest/developer-resources/plugin-api-reference/admin-panel.md @@ -632,7 +632,7 @@ export default { cellFormatter: props =>
key
)