2 minute read

Accessing and managing content via APIs is crucial in today’s digital world. Whether you’re using a content management system (CMS) or a custom-built server, knowing how to retrieve nodes through REST API is essential. This guide will show you how to accomplish this task using Postman.

Fetching Nodes

Understanding Nodes

A “node” in the context of a CMS typically refers to a unit of content, such as a document, media file, or another content object. Nodes often have associated metadata and attributes that define their properties.

Step 1: Setting Up Postman

If you don’t have Postman installed, download it from the official Postman website. Postman is a powerful API client that helps you interact with APIs by sending HTTP requests and displaying the responses.

Step 2: Creating a New Request

  1. Start a New Request:
    • Open Postman and create a new request by clicking on the “+” button.
    • Set the request type to GET since we’ll be retrieving data from the server.
  2. Enter the API URL:
    • In the request URL field, type in the endpoint for your content server’s REST API. For example:
      https://otsbd.ssbtdilnc.com/otcs/cs.exe/api/v1/nodes/19318/nodes
      

Step 3: Configure Headers

Accessing a content server usually requires authentication. Depending on the server, you need to use OTCSTICKET.

  1. Go to Headers Tab: Click on the “Headers” tab below the URL field.
  2. Add Content-Type: Include a Content-Type header with the value application/x-www-form-urlencoded to indicate that the request body will be in JSON format.
    Key: Content-Type
    Value: application/x-www-form-urlencoded
    
  3. Add OTCSTICKET: Include a OTCSTICKET header with the your_ticket_value.
    Key: OTCSTICKET
    Value: your_ticket_value
    

Step 4: Add Query Parameters (If Needed)

API allows or requires filters (like specifying the type of node you want to retrieve), you can add these as query parameters.

For example, to retrieve nodes of a specific type, such as the document type with ID “144”, you might add:

Key: type
Value: 144

Step 5: Execute the Request

  1. Send the Request:
    • Click the Send button in Postman to submit your request.
  2. View the Response:
    • After sending the request, the server’s response will appear in the lower section of Postman. The data will likely be in JSON, containing details of the nodes you requested.

Step 6: Review the Response Data

The server’s response should include information about the nodes that match your query. Common details might include:

  • Node ID: A unique identifier for each node.
  • Node Type: The classification of the content (e.g., document, media). In this case, we’re looking for type ID “144”.
  • Attributes: Metadata such as title, author, creation date, etc.

Step 7: Save and Document the Request

  1. Save Your Request:
    • If you intend to use this request again, save it by clicking the Save button. Name your request and store it in a collection.
  2. Documenting:
    • Postman allows you to document your API requests, making it easier to collaborate with your team or refer back to your work later.

Example Use Case

Imagine you need to retrieve all document nodes from your content server:

  1. API Endpoint: https://otsbd.ssbtdilnc.com/otcs/cs.exe/api/v1/nodes/19318/nodes
  2. Authentication: Include OTCSTICKET as a header parameter.
    • OTCSTICKET: your_ticket_value
  3. Query Parameters:
    • type = 144

Conclusion

Using Postman to retrieve nodes from a content server via REST API is straightforward and efficient. Following the steps outlined in this guide, you can easily access the content data you need and integrate it into your applications or workflows.

Whether you’re a developer, a content manager, or someone interested in APIs, Postman provides a robust and user-friendly platform for interacting with REST APIs. With this knowledge, you’re well-equipped to work with content servers and manage nodes effectively.

Leave a comment