### Set up TodoMVC React example Source: https://flotiq.com/docs/Deep-Dives/todomvc-react-headless-cms Clone the TodoMVC repository, navigate to the React example, install dependencies with yarn, and start the development server. These commands are part of the initial setup for the tutorial. ```bash git clone --depth=1 https://github.com/tastejs/todomvc.git ``` ```bash cd todomvc/examples/react ``` ```bash yarn ``` ```bash yarn run dev ``` -------------------------------- ### Initialize Next.js project Source: https://flotiq.com/docs/Universe/nextjs/nextjs-setup Use this command to start the setup of a new Next.js project. Use '.' as the path to install in the current directory. ```bash npx create-next-app@latest ``` -------------------------------- ### Install dependencies and start Expo server Source: https://flotiq.com/docs/Deep-Dives/mobile-expo-product-showcase Navigate to the project directory, install dependencies, and start the Expo server. The server runs at http://localhost:19002. ```bash cd flotiq-mobile-demo/ npm install npm start ``` -------------------------------- ### Install dependencies and start Gatsby development server Source: https://flotiq.com/docs/Deep-Dives/jamstack-recipes-website-complex-data-structures Navigate into the project directory, install dependencies, and start the Gatsby development server. The site will be available at http://localhost:8000. ```bash cd gatsby-starter-recipes npm install gatsby develop ``` -------------------------------- ### Install Gatsby globally Source: https://flotiq.com/docs/Deep-Dives/jamstack-recipes-website-complex-data-structures Install the Gatsby CLI globally using npm. This is the first step in the quickstart. ```bash npm install -g gatsby ``` -------------------------------- ### Example plugin-manifest.json configuration Source: https://flotiq.com/docs/panel/PluginsDevelopment/plugins A sample manifest file required for permanent organization-wide plugin installation. ```json { "id": "my-organization.example-plugin", "name": "An Example plugin", "description": "This is plugin created by My Organization to handle an example workflow for all data types", "version": "1.0.0", "repository": "https://github.com/my-organization/flotiq-example-plugin", "url": "https://example.com/index.js", "permissions": [ { "ctdName": "*", "canRead": true, "type": "CO" } ] } ``` -------------------------------- ### Run `npx flotiq-nextjs-setup` to install Flotiq SDK Source: https://flotiq.com/docs/Deep-Dives/nextjs-react-typescript-openapi This command installs the Flotiq SDK and also sets up a content cache revalidation endpoint and draft mode handling for a Next.js project. It is the recommended installation method. ```bash npx flotiq-nextjs-setup ``` -------------------------------- ### Install dependencies and build the package Source: https://flotiq.com/docs/Deep-Dives/angular-headless-cms Run these commands in the package directory to install dependencies and build the dist folder. ```bash npm install npm run build ``` -------------------------------- ### Install the built package in your application Source: https://flotiq.com/docs/Deep-Dives/angular-headless-cms Run this command in your application directory to install the package from the dist folder. ```bash npm install /dist ``` -------------------------------- ### Import example content into Flotiq Source: https://flotiq.com/docs/Deep-Dives/netlify-zapier-gatsby-serverless-deployment-pipeline Run this command to add 4 images and 2 recipes to your Flotiq account. Requires the example import script provided in the starter. ```bash node ./example/importExample.js ``` -------------------------------- ### Start Copilot CLI Source: https://flotiq.com/docs/Universe/MCP/copilot-cli Run the 'copilot' command to start GitHub Copilot CLI before adding the Flotiq MCP server. ```bash copilot ``` -------------------------------- ### Java OkHttp API Request Source: https://flotiq.com/docs/API/content-type/listing-co?h=listin Example of a GET request to the blogposts endpoint using Java and the OkHttp library. ```java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.flotiq.com/api/v1/content/blogposts?page=1&limit=20&order_by=internal.createdAt&order_direction=asc&hydrate=0&filters=%7B%22title%22%3A%7B%22type%22%3A%22equals%22%2C%22filter%22%3A%22New%20object%22%7D%2C%22postContent%22%3A%7B%22type%22%3A%22contains%22%2C%22filter%22%3A%22content%22%7D%7D") .get() .addHeader("X-AUTH-TOKEN", "YOUR_API_KEY") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### PHP - cURL GET /api/auth-context Source: https://flotiq.com/docs/API PHP curl example that sends a GET request with X-AUTH-TOKEN header and prints the response or an error if curl fails. ```PHP + CURL "https://api.flotiq.com/api/auth-context", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "X-AUTH-TOKEN: YOUR_API_KEY", ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ``` -------------------------------- ### Install node-fetch Source: https://flotiq.com/docs/Deep-Dives/todomvc-react-headless-cms Install node-fetch version 2 as a dependency to enable making HTTP requests from the React app. ```bash npm install --save node-fetch@2 ``` -------------------------------- ### Go Native API Request Source: https://flotiq.com/docs/API/content-type/listing-co?h=listin Example of a GET request to the blogposts endpoint using Go's native net/http package. ```go package main import ( "fmt" "net/http" "io/ioutil" ) func main() { url := "https://api.flotiq.com/api/v1/content/blogposts?page=1&limit=20&order_by=internal.createdAt&order_direction=asc&hydrate=0&filters=%7B%22title%22%3A%7B%22type%22%3A%22equals%22%2C%22filter%22%3A%22New%20object%22%7D%2C%22postContent%22%3A%7B%22type%22%3A%22contains%22%2C%22filter%22%3A%22content%22%7D%7D" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-AUTH-TOKEN", "YOUR_API_KEY") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### GET response for possible transitions of an object Source: https://flotiq.com/docs/API/workflow/content-publishing-workflow Example response from a GET request to /api/v1/workflow/:content_type/:object_id, showing the current state and enabled transitions. ```json { "state": "public", "enabled_transitions": [ { "name": "_public_archive", "froms": [ "public" ], "tos": [ "archive" ] } ] } ``` -------------------------------- ### Install Expo CLI Source: https://flotiq.com/docs/Flotiq-Mobile-Expo/overview Install the Expo CLI globally. Required before cloning and running the Flotiq mobile demo project. ```bash npm install --global expo-cli ``` -------------------------------- ### BatchResponseSuccess example Source: https://flotiq.com/docs/API/open-api-schema Example response for a successful batch operation. Shows the BatchResponseSuccess schema with zero errors. ```json { "batch_total_count": 2, "batch_success_count": 2, "batch_error_count": 0, "errors": [] } ``` -------------------------------- ### Install lxml package Source: https://flotiq.com/docs/Deep-Dives/wordpress-import Installs the lxml Python package required for parsing the WordPress XML dump. ```bash pip install lxml ``` -------------------------------- ### Install Python SDK dependencies Source: https://flotiq.com/docs/Deep-Dives/wordpress-import Run this command in the extracted SDK folder to install required Python packages before creating the import script. ```bash pip install -r requirements.txt ``` -------------------------------- ### Unstructured ingredient list example 3 Source: https://flotiq.com/docs/Deep-Dives/jamstack-recipes-website-complex-data-structures An example of unstructured ingredient input using HTML list tags. ```html ``` -------------------------------- ### Unstructured ingredient list example 1 Source: https://flotiq.com/docs/Deep-Dives/jamstack-recipes-website-complex-data-structures An example of unstructured ingredient input using plain text lines. ```text 2 eggs 1 pinch of salt 1 tbsp of butter ``` -------------------------------- ### Batch delete success response example Source: https://flotiq.com/docs/API/content-type/deleting-co Example success response showing that two objects were deleted. ```json { "deletedCount": 2 } ``` -------------------------------- ### API Response Examples Source: https://flotiq.com/docs/API/content-type/updating-co Examples of successful and validation error responses from the API. ```json { "id": "blogposts-456712", "internal": { "contentType": "blogposts", "createdAt": "2021-04-09T13:30:48+00:00", "updatedAt": "2021-04-09T13:30:48+00:00", "deletedAt": "" }, "title": "Object with changed title", "postContent": "This will be the new content" } ``` ```json { "title": [ "The property title is required", "Must be at least 1 characters long", "The property title is required" ], "postContent": [ "The property postContent is required", "Must be at least 1 characters long", "The property postContent is required" ] } ``` -------------------------------- ### Go GET request to fetch content type Source: https://flotiq.com/docs/API/content-type/getting-ctd Uses net/http to send a GET request and prints the response body. ```go package main import ( "fmt" "net/http" "io/ioutil" ) func main() { url := "https://api.flotiq.com/api/v1/internal/contenttype/blogposts" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-AUTH-TOKEN", "YOUR_API_KEY") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### 404Response example Source: https://flotiq.com/docs/API/open-api-schema Example response for a 404 error, using the 404Response schema. ```json { "code": 404, "message": "Not found" } ``` -------------------------------- ### 403Response example Source: https://flotiq.com/docs/API/open-api-schema Example response for a 403 error, using the 403Response schema. Note that the schema definition includes a 'data' property but the example uses 'message'. ```json { "code": 403, "message": "Access denied or quota limit exceeded" } ``` -------------------------------- ### Unstructured ingredient list example 2 Source: https://flotiq.com/docs/Deep-Dives/jamstack-recipes-website-complex-data-structures An example of unstructured ingredient input using a dash-separated list format. ```text - Eggs: 2 - Salt: 1 pinch - Butter: 1 tbsp ``` -------------------------------- ### 401Response example Source: https://flotiq.com/docs/API/open-api-schema Example response for a 401 error, using the 401Response schema. ```json { "code": 401, "message": "Unauthorized" } ``` -------------------------------- ### Install Expo CLI Source: https://flotiq.com/docs/Deep-Dives/mobile-expo-product-showcase Install the Expo CLI globally using npm. Requires Node 12 LTS or greater. ```bash npm install -g expo-cli ``` -------------------------------- ### Install OpenAPI Generator CLI Source: https://flotiq.com/docs/API/generate-package Install the OpenAPI generator globally using npm to enable custom package generation. ```bash npm install @openapitools/openapi-generator-cli -g ``` -------------------------------- ### Install Flotiq CLI globally Source: https://flotiq.com/docs/CLI Use this command to install the Flotiq CLI globally on your system. Requires Node.js version 9 or higher. ```bash npm install -g flotiq-cli ``` -------------------------------- ### Go - GET /api/auth-context using net/http Source: https://flotiq.com/docs/API Sends a GET request in Go with the X-AUTH-TOKEN header. It prints the response status and body to stdout. ```Go package main import ( "fmt" "net/http" "io/ioutil" ) func main() { url := "https://api.flotiq.com/api/auth-context" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-AUTH-TOKEN", "YOUR_API_KEY") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### OpenAPI Schema Example - _tagVersionsList Source: https://flotiq.com/docs/API/open-api-schema Definition for the _tagVersionsList schema, combining SystemListProperties with versionsList. ```json { "type": "object", "allOf": [ { "$ref": "#/components/schemas/SystemListProperties" }, { "$ref": "#/components/schemas/versionsList" } ] } ``` -------------------------------- ### OpenAPI Schema Example - _tag Source: https://flotiq.com/docs/API/open-api-schema Definition for the _tag schema, extending AbstractContentTypeSchemaDefinition with a required name property and an example including internal metadata. ```json { "type": "object", "allOf": [ { "$ref": "#/components/schemas/AbstractContentTypeSchemaDefinition" }, { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "description": "" } } } ], "required": [ "name" ], "additionalProperties": false, "examples": [ { "id": "_tag-1", "internal": { "contentType": "_tag", "createdAt": "2025-06-05T10:24:27+00:00", "updatedAt": "2025-06-05T10:24:27+00:00", "deletedAt": "", "workflowState": "saved", "objectTitle": "", "latestVersion": 1 }, "name": "name" } ] } ``` -------------------------------- ### Basic GET request to list content objects (Go) Source: https://flotiq.com/docs/API/content-type/listing-co?h=listin Uses Go's net/http to send a GET request to the Flotiq API for the 'blogposts' content type. Requires an API key. ```go package main import ( "fmt" "net/http" "io/ioutil" ) func main() { url := "https://api.flotiq.com/api/v1/content/blogposts" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("X-AUTH-TOKEN", "YOUR_API_KEY") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Batch update Media objects - request body example Source: https://flotiq.com/docs/API/open-api-schema Example request body for the Media_batchPut operation. It shows an array of Media objects with fields like id, extension, fileName, mimeType, size, type, source, tags, variants, externalId, url, height, and width. The example includes two identical objects. ```json [ { "id": "_media-698d20aa-193a-47b3-be4d-550c1aab47e7", "extension": "png", "fileName": "example_image.png", "mimeType": "image/png", "size": 87258, "type": "image", "source": "disk", "tags": [ { "dataUrl": "/api/v1/content/_tag/_tag-641775", "type": "internal" } ], "variants": [ { "name": "square", "trim": { "top": 10, "right": 10, "bottom": 10, "left": 10, "width": 10, "height": 10 } } ], "externalId": "", "url": "/image/0x0/_media-698d20aa-193a-47b3-be4d-550c1aab47e7.png", "height": 517, "width": 925 }, { "id": "_media-698d20aa-193a-47b3-be4d-550c1aab47e7", "extension": "png", "fileName": "example_image.png", "mimeType": "image/png", "size": 87258, "type": "image", "source": "disk", "tags": [ { "dataUrl": "/api/v1/content/_tag/_tag-641775", "type": "internal" } ], "variants": [ { "name": "square", "trim": { "top": 10, "right": 10, "bottom": 10, "left": 10, "width": 10, "height": 10 } } ], "externalId": "", "url": "/image/0x0/_media-698d20aa-193a-47b3-be4d-550c1aab47e7.png", "height": 517, "width": 925 } ] ``` -------------------------------- ### Basic GET request to list content objects (Java OkHttp) Source: https://flotiq.com/docs/API/content-type/listing-co?h=listin Uses OkHttp to send a GET request to the Flotiq API for the 'blogposts' content type. Requires an API key. ```java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.flotiq.com/api/v1/content/blogposts") .get() .addHeader("X-AUTH-TOKEN", "YOUR_API_KEY") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Java (OkHttp) - GET /api/auth-context Source: https://flotiq.com/docs/API Use OkHttp to send a GET request and add X-AUTH-TOKEN header. The response object is obtained but not printed in this sample. ```Java + Okhttp OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://api.flotiq.com/api/auth-context") .get() .addHeader("X-AUTH-TOKEN", "YOUR_API_KEY") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### BatchResponseError example Source: https://flotiq.com/docs/API/open-api-schema Example response for a batch operation with errors. Shows the structure of the BatchResponseError schema, including batch counts and per-item error details. ```json { "batch_total_count": 2, "batch_success_count": 0, "batch_error_count": 2, "errors": [ { "id": "test-1", "errors": { "name": [ "The property name is required" ] } }, { "id": "test-2", "errors": { "name": [ "The property name is required" ] } } ] } ``` -------------------------------- ### Create Content Type Definition with Unirest (Java) Source: https://flotiq.com/docs/API/content-type/creating-ctd Java Unirest example for creating a content type definition. Uses the same endpoint and headers as the OkHttp example, with the JSON body passed as a string. ```java HttpResponse response = Unirest.post("https://api.flotiq.com/api/v1/internal/contenttype") .header("content-type", "application/json") .header("X-AUTH-TOKEN", "YOUR_API_KEY") .body("{\"name\":\"blogposts\",\"label\":\"Blog Posts\",\"schemaDefinition\":{\"type\":\"object\",\"allOf\":[{\"$ref\":\"#/components/schemas/AbstractContentTypeSchemaDefinition\"},{\"type\":\"object\",\"properties\":{\"title\":{\"type\":\"string\"},\"postContent\":{\"type\":\"string\"}}}],\"required\":[\"title\",\"postContent\"],\"additionalProperties\":false},\"metaDefinition\":{\"propertiesConfig\":{\"title\":{\"label\":\"Title\",\"inputType\":\"text\",\"unique\":true},\"postContent\":{\"label\":\"Post content\",\"inputType\":\"richtext\",\"unique\":false}},\"order\":[\"title\",\"postContent\"]}}") .asString(); ``` -------------------------------- ### OpenAPI Schema Example - _tagWithoutInternal Source: https://flotiq.com/docs/API/open-api-schema Definition for the _tagWithoutInternal schema, extending AbstractContentTypeSchemaDefinitionWithoutInternal with a required name property and an example object. ```json { "type": "object", "allOf": [ { "$ref": "#/components/schemas/AbstractContentTypeSchemaDefinitionWithoutInternal" }, { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "description": "" } } } ], "required": [ "name" ], "additionalProperties": false, "examples": [ { "id": "_tag-1", "name": "name" } ] } ``` -------------------------------- ### Filter Example: startsWith Source: https://flotiq.com/docs/API/content-type/listing-co?h=listin Filters objects where the parameter starts with the filter value. Example: `filters={"id":{"type":"startsWith","filter":"1-"}}` returns objects with id starting with '1-'. ```json filters={"id":{"type":"startsWith","filter":"1-"}} ``` ```json { "id": "1-id", "price": 50, "title": "product-1", "internal": {...} } ``` ```json { "id": "2-id", "price": 100, "title": "product-2", "internal": {...} }, { "id": "3-id", "price": 150, "title": "product-3", "internal": {...} } ``` -------------------------------- ### Media object example response Source: https://flotiq.com/docs/API/open-api-schema Example response body for a _media content object, showing fields like id, extension, fileName, mimeType, size, type, source, tags, variants, externalId, url, height, and width. ```json { "id": "_media-698d20aa-193a-47b3-be4d-550c1aab47e7", "extension": "png", "fileName": "example_image.png", "mimeType": "image/png", "size": 87258, "type": "image", "source": "disk", "tags": [ { "dataUrl": "/api/v1/content/_tag/_tag-641775", "type": "internal" } ], "variants": [ { "name": "square", "trim": { "top": 10, "right": 10, "bottom": 10, "left": 10, "width": 10, "height": 10 } } ], "externalId": "", "url": "/image/0x0/_media-698d20aa-193a-47b3-be4d-550c1aab47e7.png", "height": 517, "width": 925 } ``` -------------------------------- ### Batch delete request body example Source: https://flotiq.com/docs/API/open-api-schema Request body example for the batch delete endpoint, an array of content object IDs to delete. ```json [ "_media-1", "_media-2" ] ``` -------------------------------- ### Run Flotiq Next.js setup Source: https://flotiq.com/docs/Universe/nextjs/nextjs-setup Execute this command to begin the Flotiq integration process, which includes SDK generation and environment variable configuration. ```bash npx flotiq-nextjs-setup ``` -------------------------------- ### OpenAPI Schema Example - _tagWithoutRequired Source: https://flotiq.com/docs/API/open-api-schema Definition for the _tagWithoutRequired schema, extending AbstractContentTypeSchemaDefinition without a required name field and including an example with internal metadata. ```json { "type": "object", "allOf": [ { "$ref": "#/components/schemas/AbstractContentTypeSchemaDefinition" }, { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "description": "" } } } ], "additionalProperties": false, "examples": [ { "id": "_tag-1", "internal": { "contentType": "_tag", "createdAt": "2025-06-05T10:24:27+00:00", "updatedAt": "2025-06-05T10:24:27+00:00", "deletedAt": "", "workflowState": "saved", "objectTitle": "", "latestVersion": 1 }, "name": "name" } ] } ``` -------------------------------- ### Complex GET request with parameters (C# RestSharp) Source: https://flotiq.com/docs/API/content-type/listing-co?h=listin Uses RestSharp to send a GET request with the same parameters as the cURL example, including URL-encoded filters. Requires an API key. ```csharp var client = new RestClient("https://api.flotiq.com/api/v1/content/blogposts?page=1&limit=20&order_by=internal.createdAt&order_direction=asc&hydrate=0&filters=%7B%22title%22%3A%7B%22type%22%3A%22equals%22%2C%22filter%22%3A%22Hello%20world%22%7D%7D"); var request = new RestRequest(Method.GET); request.AddHeader("X-AUTH-TOKEN", "YOUR_API_KEY"); IRestResponse response = client.Execute(request); ``` -------------------------------- ### C# - RestSharp client GET /api/auth-context Source: https://flotiq.com/docs/API Use RestSharp to create a GET request and pass the X-AUTH-TOKEN header. This example uses the deprecated RestRequest constructor and AddHeader method. ```C# var client = new RestClient("https://api.flotiq.com/api/auth-context"); var request = new RestRequest(Method.GET); request.AddHeader("X-AUTH-TOKEN", "YOUR_API_KEY"); IRestResponse response = client.Execute(request); ``` -------------------------------- ### OpenAPI Schema Example - _tagList Source: https://flotiq.com/docs/API/open-api-schema Definition for the _tagList schema, using SystemListProperties and a data array of _tag objects. ```json { "type": "object", "allOf": [ { "$ref": "#/components/schemas/SystemListProperties" }, { "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/_tag" } } } } ] } ``` -------------------------------- ### Example content object with workflowPublishedAt and workflowPublicVersion fields Source: https://flotiq.com/docs/API/workflow/content-publishing-workflow Example content object showing the internal fields workflowPublishedAt and workflowPublicVersion. When the object is the latest public version, these fields point to the current object's updatedAt and latestVersion. ```json { "id": "snipcart-584874", "name": "Gunpowder Temple Of Heaven", "image": [ { "type": "internal", "dataUrl": "/api/v1/content/_media/_media-5e17192889e87" } ], "price": 22, "internal": { "createdAt": "2020-01-08T13:29:28+00:00", "deletedAt": "", "updatedAt": "2020-01-09T12:30:38+00:00", "contentType": "snipcart", "workflowState": "public", "latestVersion": 2, "workflowPublicVersion" : 2, "workflowPublishedAt" : "2020-01-09T12:30:38+00:00", } } ``` -------------------------------- ### Batch create with CURL Source: https://flotiq.com/docs/API/content-type/creating-co Command line example for batch creating or updating blog posts. ```bash curl 'https://api.flotiq.com/api/v1/content/blogposts/batch?updateExisting=true' \ --header 'accept: application/json' \ --header 'X-AUTH-TOKEN: YOUR_API_TOKEN' \ --header 'Content-Type: application/json' \ --data-binary '[{"id":"example-id-1","title":"New object","content": "This will be the new content"},{"id":"example-id-1","title":"New object 2","postContent":"This will be the brand new content"}]' ``` -------------------------------- ### PHP cURL API Request Source: https://flotiq.com/docs/API/content-type/listing-co?h=listin Example of a GET request to the blogposts endpoint using PHP and cURL. ```php "https://api.flotiq.com/api/v1/content/blogposts?page=1&limit=20&order_by=internal.createdAt&order_direction=asc&hydrate=0&filters=%7B%22title%22%3A%7B%22type%22%3A%22equals%22%2C%22filter%22%3A%22New%20object%22%7D%2C%22postContent%22%3A%7B%22type%22%3A%22contains%22%2C%22filter%22%3A%22content%22%7D%7D", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_HTTPHEADER => [ "X-AUTH-TOKEN: YOUR_API_KEY", ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ``` -------------------------------- ### Basic GET request to list content objects (Node.js Request) Source: https://flotiq.com/docs/API/content-type/listing-co?h=listin Uses the request library to send a GET request to the Flotiq API for the 'blogposts' content type. Requires an API key. ```javascript const request = require('request'); const options = { method: 'GET', url: 'https://api.flotiq.com/api/v1/content/blogposts', headers: {'X-AUTH-TOKEN': 'YOUR_API_KEY'}, }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); }); ``` -------------------------------- ### Run local development server Source: https://flotiq.com/docs/Universe/nextjs/nextjs-setup Starts the local development server, deploying the project locally at http://localhost:3000. The address may change in staging or production, or if the --port flag is used. ```bash npm run dev ``` -------------------------------- ### C# RestSharp API Request Source: https://flotiq.com/docs/API/content-type/listing-co?h=listin Example of a GET request to the blogposts endpoint using C# and RestSharp. ```csharp var client = new RestClient("https://api.flotiq.com/api/v1/content/blogposts?page=1&limit=20&order_by=internal.createdAt&order_direction=asc&hydrate=0&filters=%7B%22title%22%3A%7B%22type%22%3A%22equals%22%2C%22filter%22%3A%22New%20object%22%7D%2C%22postContent%22%3A%7B%22type%22%3A%22contains%22%2C%22filter%22%3A%22content%22%7D%7D"); var request = new RestRequest(Method.GET); request.AddHeader("X-AUTH-TOKEN", "YOUR_API_KEY"); IRestResponse response = client.Execute(request); ``` -------------------------------- ### CURL API Request Source: https://flotiq.com/docs/API/content-type/listing-co?h=listin Example of a GET request to the blogposts endpoint using cURL with encoded filters. ```bash curl -X GET "https://api.flotiq.com/api/v1/content/blogposts?page=1&limit=20&order_by=internal.createdAt&order_direction=asc&hydrate=0&filters=%7B%22title%22%3A%7B%22type%22%3A%22equals%22%2C%22filter%22%3A%22New%20object%22%7D%2C%22postContent%22%3A%7B%22type%22%3A%22contains%22%2C%22filter%22%3A%22content%22%7D%7D" --header "X-AUTH-TOKEN: YOUR_API_KEY" --header "accept: application/json" ``` -------------------------------- ### Create a new Gatsby project from the Flotiq starter template Source: https://flotiq.com/docs/Deep-Dives/jamstack-recipes-website-complex-data-structures Use the Gatsby CLI to create a new project named 'gatsby-starter-recipes' from the Flotiq starter repository on GitHub. ```bash gatsby new gatsby-starter-recipes https://github.com/flotiq/gatsby-starter-recipes.git ``` -------------------------------- ### GraphQL query to get id and title of a blog post Source: https://flotiq.com/docs/API/get-started Example GraphQL query to retrieve the 'id' and 'title' fields for a blog post with ID 'blogposts-456712'. This query is used in the subsequent API call examples. ```GraphQL query { blogposts(id:"blogposts-456712") { id title } } ``` -------------------------------- ### OpenAPI Schema Example - _mediaDefinition Source: https://flotiq.com/docs/API/open-api-schema Example of a schema definition for the _media content type, showing its properties including externalId, url, height, width, and internal metadata. Used for media file representation in the Flotiq API. ```json { } ], "externalId": "", "url": "/image/0x0/_media-698d20aa-193a-47b3-be4d-550c1aab47e7.png", "height": 517, "width": 925, "internal": { "contentType": "_media", "createdAt": "2025-02-06T10:24:27+00:00", "updatedAt": "2025-02-06T10:24:27+00:00", "deletedAt": "", "workflowState": "saved", "objectTitle": "example_image.png", "latestVersion": 1 } } ] }, "_mediaList": { "type": "object", "allOf": [ { "$ref": "#/components/schemas/SystemListProperties" }, { "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/_media" } } } } ] }, "_mediaVersionsList": { "type": "object", "allOf": [ { "$ref": "#/components/schemas/SystemListProperties" }, { "$ref": "#/components/schemas/versionsList" } ] } ``` -------------------------------- ### Batch create with Go Source: https://flotiq.com/docs/API/content-type/creating-co Implementation using Go's standard net/http library. ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.flotiq.com/api/v1/content/blogposts/batch?updateExisting=true" payload := strings.NewReader("[{\"id\":\"example-id-1\",\"title\":\"New object\",\"content\":\"This will be the new content\"},{\"id\":\"example-id-1\",\"title\":\"New object 2\",\"postContent\":\"This will be the brand new content\"}]") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("accept", "application/json") req.Header.Add("content-type", "application/json") req.Header.Add("X-AUTH-TOKEN", "YOUR_API_TOKEN") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Node.js Request API Request Source: https://flotiq.com/docs/API/content-type/listing-co?h=listin Example of a GET request to the blogposts endpoint using Node.js and the request library. ```javascript const request = require('request'); const options = { method: 'GET', url: 'https://api.flotiq.com/api/v1/content/blogposts', qs: { page: '1', limit: '20', order_by: 'internal.createdAt', order_direction: 'asc', hydrate: '0', filters: '{"title":{"type":"equals","filter":"New object"},"postContent":{"type":"contains","filter":"content"}}' }, headers: {'X-AUTH-TOKEN': 'YOUR_API_KEY'}, }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); }); ``` -------------------------------- ### Connect to Flotiq API with Python Source: https://flotiq.com/docs/Deep-Dives/wordpress-import Sets up the Flotiq API client using an API key passed as a command-line argument and lists existing blog posts. Requires the flotiq package and a Read/Write API key from the user profile. ```python import flotiq from flotiq.rest import ApiException import sys configuration = flotiq.Configuration() configuration.api_key['X-AUTH-TOKEN'] = sys.argv[1] api_instance = flotiq.ContentBlogPostsApi(flotiq.ApiClient(configuration)) entries = api_instance.entries_list() print(entries) ``` -------------------------------- ### Java Unirest API Request Source: https://flotiq.com/docs/API/content-type/listing-co?h=listin Example of a GET request to the blogposts endpoint using Java and the Unirest library. ```java HttpResponse response = Unirest.get("https://api.flotiq.com/api/v1/content/blogposts?page=1&limit=20&order_by=internal.createdAt&order_direction=asc&hydrate=0&filters=%7B%22title%22%3A%7B%22type%22%3A%22equals%22%2C%22filter%22%3A%22New%20object%22%7D%2C%22postContent%22%3A%7B%22type%22%3A%22contains%22%2C%22filter%22%3A%22content%22%7D%7D") .header("X-AUTH-TOKEN", "YOUR_API_KEY") .asString(); ``` -------------------------------- ### Create Content Object with Go Source: https://flotiq.com/docs/API/content-type/creating-co Example of creating a content object using Go's native net/http package. ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.flotiq.com/api/v1/content/blogposts" payload := strings.NewReader("{\"title\":\"New object\",\"postContent\":\"This will be the new content\"}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("content-type", "application/json") req.Header.Add("X-AUTH-TOKEN", "YOUR_API_KEY") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Run import.py with API key Source: https://flotiq.com/docs/Deep-Dives/wordpress-import Executes the import script with the API key as the first argument. The expected output is an empty data list if no blog entries exist yet. ```bash python import.py YOUR_API_KEY {'data': []} ``` -------------------------------- ### Example variant configuration Source: https://flotiq.com/docs/API/variants A sample configuration for a 'thumbnail' variant using the trim transformation with specific dimensions. ```json { "name": "thumbnail", "trim": { "top": 10, "right": 10, "width":200, "height":200 } } ``` -------------------------------- ### Response 200 OK for GET Content Object Source: https://flotiq.com/docs/API/content-type/getting-co Example JSON response returned when the object is found. Contains the object's id, internal metadata, and content fields. ```json { "id": "blogposts-456712", "internal": { "contentType": "blogposts", "createdAt": "2021-04-09T13:30:48+00:00", "updatedAt": "2021-04-09T13:30:48+00:00", "deletedAt": "", "publicVersion": -1, "publishedAt": "", "status": "public" }, "title": "New object", "postContent": "This will be the new content" } } ``` -------------------------------- ### OpenAPI Schema Example - versionItem Source: https://flotiq.com/docs/API/open-api-schema Definition for the versionItem schema, extending AbstractContentTypeSchemaDefinition with fields for id, deletedAt, createdAt, updatedAt, current, version, owner, and related user properties. ```json { "type": "object", "allOf": [ { "$ref": "#/components/schemas/AbstractContentTypeSchemaDefinition" }, { "type": "object", "properties": { "id": { "type": "string" }, "deletedAt": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "current": { "type": "boolean" }, "version": { "type": "number" }, "owner": { "type": "object", "properties": { "id": { "type": "string" }, "username": { "type": "string" }, "email": { "type": "string" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "roles": { "type": "array", "items": { "type": "string" } } } } } } ] } ``` -------------------------------- ### Response for full version 3.1 Source: https://flotiq.com/docs/API/open-api-schema Example response for the version 3.1 Open API Schema request. The response is a JSON object with the openapi field set to 3.1.0. ```json { "openapi": "3.1.0", "info": { ``` -------------------------------- ### GET /api/v1/content/product?hydrate=1 (Hydrating objects) Source: https://flotiq.com/docs/API/content-type/listing-co This example retrieves a list of content objects with hydration enabled (hydrate=1) to embed related objects. The response includes the related category names. ```APIDOC ## GET /api/v1/content/product?hydrate=1 ### Description Retrieves content objects with related objects embedded (hydrated). Setting hydrate=1 includes immediate related objects; hydrate=2 includes nested related objects. ### Method GET ### Endpoint /api/v1/content/product?hydrate=1 ### Parameters #### Query Parameters - **hydrate** (integer) - Optional - Level of hydration: 1 or 2 (max). Default is no hydration if omitted. ### Request Example ``` curl -X GET "https://api.flotiq.com/api/v1/content/product?hydrate=1" --header "X-AUTH-TOKEN: YOUR_API_KEY" --header "accept: application/json" ``` ### Response #### Success Response (200) Returns a list of content objects with hydrated related objects included in the response. #### Response Example ``` { "id": "7-id", "title": "product-7", "categories": [{ "type": "internal", "dataUrl": "/api/v1/content/category/group-a-cat-1" }], "internal": {...}, "category": { "name": "Category Name" } } ``` ``` -------------------------------- ### Batch create Content Objects with Go Source: https://flotiq.com/docs/API/content-type/creating-co Implementation using the native Go net/http package. ```go package main import ( "fmt" "strings" "net/http" "io/ioutil" ) func main() { url := "https://api.flotiq.com/api/v1/content/blogposts/batch?updateExisting=true" payload := strings.NewReader("[{\"id\":\"existing-id-1\",\"title\":\"Updated object\"},{\"id\":\"new-object-2\",\"title\":\"New object 3\",\"postContent\":\"This will be the brand new content\"}]") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("accept", "application/json") req.Header.Add("content-type", "application/json") req.Header.Add("X-AUTH-TOKEN", "YOUR_API_TOKEN") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Run flotiq start command Source: https://flotiq.com/docs/CLI/starting-new-project-gatsby The base command to initialize a new Gatsby project using the Flotiq CLI. ```bash flotiq start [directory] [url] [flotiqApiKey] [framework] ``` -------------------------------- ### curl request to get Open API Schema Source: https://flotiq.com/docs/API/open-api-schema Use this curl command to fetch the default Open API Schema (version 3.0) from Flotiq. Replace YOUR_API_KEY with your Read-only or Read and write API key. ```bash curl -X GET "https://api.flotiq.com/api/v1/open-api-schema.json" \ -H 'accept: */*' \ -H 'X-AUTH-TOKEN: YOUR_API_KEY' \ -H 'Content-Type: application/json' ```