Managing Pages via Venddor IO API

Introduction

Venddor IO provides an intuitive API to handle pages on your platform. Through this system, you can create, view, update, and delete pages effortlessly. Let's delve into how to maximize its potential.

Accessing Pages

All Pages

Endpoint: http://example.com/api/2.0/pages/
Methods: GET (to retrieve all pages) and POST (to create a new page).

Specific Page

Endpoint: http://example.com/api/2.0/pages/:id
Methods: GET (for viewing), PUT (for updating), and DELETE (for removal).

Pagination and Filtering

You have the ability to fine-tune your queries to find specific pages or alter the way they're displayed:

For instance, accessing http://example.com/api/2.0/pages?page=5&items_per_page=20 would give you 20 pages from the fifth page of results.

Page Attributes

Every page comes with several attributes or fields. Some of these are mandatory, like page_type and page, while others provide additional information about the page. These fields can vary from basic identifiers, timestamps, status, and content to SEO-specific attributes and special properties exclusive to links or blog posts.

Using the API

Viewing All Pages

curl -X GET 'http://example.com/api/2.0/pages'

This fetches a list of pages and their respective attributes.

Viewing a Specific Page

curl -X GET 'http://example.com/api/2.0/pages/1'

This returns attributes of the page with the ID of 1.

Creating a New Page

For this, the body of the HTTP request must contain the necessary data, adhering to the specified content-type. For successful creation, a HTTP/1.1 201 Created response is sent.

curl --header 'Content-type: text/plain' -X POST 'http://example.com/api/2.0/pages' --data-binary 'page_type=T&page=Test Page&status=H&description=<p>This is a test page to see how the API works.</p>'

This command creates a new hidden page named "Test Page" with a provided description.

Updating a Page

When updating, send data in the request body according to the content-type.

curl --header 'Content-type: text/plain' -X PUT 'http://example.com/api/2.0/pages/226' --data-binary 'status=A'

Here, the status of the page with an ID of 226 is changed to "Active".

Deleting a Page

curl -X DELETE 'http://example.com/api/2.0/pages/226'

This command will delete the page with an ID of 226.

Conclusion

Venddor IO's API for managing pages is a potent tool, allowing for robust and intricate control of platform content. Whether you're handling simple site pages, external links, module-based forms, or blog posts, Venddor IO ensures that you have the capability and flexibility needed for modern digital experiences.