Skip to content

Commit

Permalink
Merge pull request #291 from flotiq/feature/25491-graphql-fetch-singl…
Browse files Browse the repository at this point in the history
…e-cto-with-custom-field

Feature #25491 graphql fetch single cto with custom field
  • Loading branch information
KarolNet authored Oct 17, 2024
2 parents 92b4fdc + 73b9cfd commit 5634525
Show file tree
Hide file tree
Showing 13 changed files with 274 additions and 221 deletions.
2 changes: 1 addition & 1 deletion docs/API/content-type/creating-co.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ to the supporting endpoint `https://api.flotiq.com/api/v1/content/{name}`
```
{ data-search-exclude }

!!! Responses
!!! Response

=== "200 OK"

Expand Down
2 changes: 1 addition & 1 deletion docs/API/content-type/creating-ctd.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ The first input in the form in the CMS panel will be `title` input, and the seco
```
{ data-search-exclude }

!!! Responses
!!! Response

=== "200 OK"

Expand Down
2 changes: 1 addition & 1 deletion docs/API/content-type/deleting-co.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Deleting is done by sending `DELETE` request to `https://api.flotiq.com/api/v1/c
{ data-search-exclude }


!!! Responses
!!! Response

=== "204 OK"

Expand Down
2 changes: 1 addition & 1 deletion docs/API/content-type/deleting-ctd.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ You can only delete Content Types that do not have any Content Objects or are no
```
{ data-search-exclude }

!!! Responses
!!! Response

=== "200 OK"

Expand Down
2 changes: 1 addition & 1 deletion docs/API/content-type/getting-co.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Request parameters
| --------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| hydrate | If you want to hydrate data sources in the object, you need to set it to `1`, it will hydrate one level of data sources in objects, `2` will hydrate deeper objects, and it's the highest level of hydration available in Flotiq API |

!!! Responses
!!! Response

=== "200 OK"

Expand Down
2 changes: 1 addition & 1 deletion docs/API/content-type/getting-ctd.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Possible request parameters:
```
{ data-search-exclude }

!!! Responses
!!! Response

=== "200 OK"

Expand Down
2 changes: 1 addition & 1 deletion docs/API/content-type/listing-co.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ Request parameters
| hydrate | If you want to hydrate data sources in the object, you need to set it to `1`, it will hydrate one level of data sources in objects, `2` will hydrate deeper objects, and it's the highest level of hydration available in Flotiq API. You can also use this parameter when requesting a single object |
| filters | Json encoded object containing conditions on which the list of CO should be filtered. |

!!! Responses
!!! Response

=== "200 OK"

Expand Down
2 changes: 1 addition & 1 deletion docs/API/content-type/listing-ctd.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Possible request parameters:
```
{ data-search-exclude }

!!! Responses
!!! Response

=== "200 OK"

Expand Down
2 changes: 1 addition & 1 deletion docs/API/content-type/updating-co.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ to the supporting endpoint `https://api.flotiq.com/api/v1/content/{name}/{id}` t
{ data-search-exclude }


!!! Responses
!!! Response

=== "200 OK"

Expand Down
4 changes: 2 additions & 2 deletions docs/API/content-type/updating-ctd.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ When you change existing property, depending on the type of changes, Flotiq will
```
{ data-search-exclude }

!!! Responses
!!! Response

=== "200 OK"

Expand Down Expand Up @@ -455,7 +455,7 @@ When you modify a schema, any associated objects undergo a transformation proces

When encountering issues during schema conversion, you might receive error messages like the following:

!!! Responses
!!! Response

=== "400 Validation error"

Expand Down
185 changes: 92 additions & 93 deletions docs/API/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Retrieve the schema of a specific Content Object by sending a `GET` request to t
```
{ data-search-exclude }

!!! Responses
!!! Response

=== "200 OK"

Expand Down Expand Up @@ -229,125 +229,124 @@ To pass this query to the Flotiq, you need to call:

!!! Example

=== "CURL"
=== "CURL"

```
curl -X POST 'https://api.flotiq.com/api/graphql' \
--header 'X-AUTH-TOKEN: YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"query { blogposts(id: \"blogposts-456712\") { id title } }"}'
```
{ data-search-exclude }
```
curl -X POST 'https://api.flotiq.com/api/graphql' \
--header 'X-AUTH-TOKEN: YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"query { blogposts(id: \"blogposts-456712\") { id title } }"}'
```
{ data-search-exclude }

=== "JavaScript + Fetch"
=== "JavaScript + Fetch"

```
fetch('https://api.flotiq.com/api/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-AUTH-TOKEN': 'YOUR_API_TOKEN'
},
body: JSON.stringify({
```
fetch('https://api.flotiq.com/api/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-AUTH-TOKEN': 'YOUR_API_TOKEN'
},
body: JSON.stringify({
query: 'query { blogposts(id: "blogposts-456712") { id title } }'
})
})
.then(response => response.json())
.then(data => console.log(data));
```
{ data-search-exclude }

=== "Node + Axios"

```
const axios = require('axios');

axios.post('https://api.flotiq.com/api/graphql', {
query: 'query { blogposts(id: "blogposts-456712") { id title } }'
}, {
headers: {
'Content-Type': 'application/json',
'X-AUTH-TOKEN': 'YOUR_API_TOKEN'
}
})
})
.then(response => response.json())
.then(data => console.log(data));
```
{ data-search-exclude }
.then(response => console.log(response.data))
.catch(error => console.log(error));
```
{ data-search-exclude }

=== "Node + Axios"
=== "Python + Requests"

```
const axios = require('axios');
```
import requests

axios.post('https://api.flotiq.com/api/graphql', {
query: 'query { blogposts(id: "blogposts-456712") { id title } }'
}, {
headers: {
url = 'https://api.flotiq.com/api/graphql'
headers = {
'Content-Type': 'application/json',
'X-AUTH-TOKEN': 'YOUR_API_TOKEN'
}
})
.then(response => console.log(response.data))
.catch(error => console.log(error));
```
{ data-search-exclude }

=== "Python + Requests"

```
import requests

url = 'https://api.flotiq.com/api/graphql'
headers = {
'Content-Type': 'application/json',
'X-AUTH-TOKEN': 'YOUR_API_TOKEN'
}
data = {
'query': 'query { blogposts(id: "blogposts-456712") { id title } }'
}
data = {
'query': 'query { blogposts(id: "blogposts-456712") { id title } }'
}

response = requests.post(url, headers=headers, json=data)
print(response.json())
```
{ data-search-exclude }
response = requests.post(url, headers=headers, json=data)
print(response.json())
```
{ data-search-exclude }


!!! Response
=== "200 OK"
=== "200 OK"

Returned when the object was found
Returned when the object was found

```json
{
"data": {
"blogposts": {
"id": "blogposts-456712",
"title": "New object"
```json
{
"data": {
"blogposts": {
"id": "blogposts-456712",
"title": "New object"
}
}
}
}
```
{ data-search-exclude }
```
{ data-search-exclude }

=== "401 Unauthorized"
=== "401 Unauthorized"

Returned when the API key was missing or incorrect
Returned when the API key was missing or incorrect

```json
{
"errors": [
{
"message": "Unauthorized",
"extensions": {
"code": "UNAUTHORIZED"
```json
{
"errors": [
{
"message": "Unauthorized",
"extensions": {
"code": "UNAUTHORIZED"
}
}
}
]
}
```
{ data-search-exclude }
]
}
```
{ data-search-exclude }

=== "404 Not found"
=== "404 Not found"

Returned when the content type definition wasn't found
Returned when the content type definition wasn't found

```json
{
"errors": [
{
"message": "Not found",
"extensions": {
"code": "NOT_FOUND"
```json
{
"errors": [
{
"message": "Not found",
"extensions": {
"code": "NOT_FOUND"
}
}
}
]
}
```
{ data-search-exclude }

]
}
```
{ data-search-exclude }

#### Step 2: Exploring Advanced Features
Flotiq API offers various advanced features and functionalities to enhance your application. Here are a few examples:
Expand Down
Loading

0 comments on commit 5634525

Please sign in to comment.