Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Find the create-endpoint-4-template endpoint, which is used for setting up new REST APIs for each SPARQL template.

  2. Click on the "Try it out" button to enable interactive usage of this endpoint.

  3. Configure the Endpoint Details

    • In the records array, you will configure each CRUD operation as a separate object. Hereโ€™s how you can set up each endpoint for the EditorialObject class:

      Code Block
      languagejson
      {
          "records": [
              {
                  "endpoint": "editorialObject",
                  "baseURL": "/v1",
                  "endpointConfig": [
                      {
                          "method": "get",
                          "template": "readEditorialObject"
                      },
                      {
                          "method": "post",
                          "template": "createEditorialObject"
                      },
                      {
                          "method": "put",
                          "template": "updateEditorialObject"
                      },
                      {
                          "method": "delete",
                          "template": "deleteEditorialObject"
                      }
                  ]
              }
          ]
      }
    • Variable Descriptions

      • records: This array holds one or more configuration objects. Each object defines a set of CRUD operations associated with a specific endpoint.

        • endpoint: This string specifies the name of the endpoint. It acts as a part of the URL path where the API will be accessible. For example, "editorialObject" results in a REST endpoint that could be accessed via ${baseURL}/editorialObject.

        • baseURL: This is the base path under which the endpoint will be grouped. For instance, "/v1" indicates that the endpoint will be accessed under the version 1 group, forming part of the complete URL path.

        • endpointConfig: An array of objects where each object specifies a CRUD operation and the associated settings:

          • method: The HTTP method (e.g., "get", "post", "put", "delete") that determines what kind of operation this endpoint will perform. This corresponds to the CRUD operation:

            • "get" for reading or retrieving data,

            • "post" for creating new data,

            • "put" for updating existing data,

            • "delete" for removing data.

          • template: The name of the SPARQL template that will be executed when this endpoint is called. It ties the REST API directly to a predefined SPARQL operation within the database management system.

  4. Execute the Configuration:

    After entering all the necessary details, click on the "Execute" button. A successful request will create REST endpoints for each configured operation.

    route request res.pngImage Added

  5. The response will indicate success, confirming that the endpoints are now set up and ready for use.

...

  1. route request.pngImage Added

Curl Commands for Executing REST API

Execute API Calls:

...

With the REST API configured, you can now use tools like Postman or any programming language that supports HTTP requests to interact with these endpoints.

...

1. Create (POST)

To create a new EditorialObject, use the following curl command to send a POST request:

Code Block
languagebash
curl -X POST "http://localhost/enapso-dev/view-management/v1/editorialObject" -H "Content-Type: application/json" -d "{\"variables\": {\"iri\": \"http://ont.enapso.com/sparql-template#EditorialObject_2f9b1462-e937-4416-8c23-ce96fc42dc55\", \"title\": \"Never Look Away\", \"shotLog\": \"Visual storytelling that captures the protagonist artistic journey and the tumultuous history of Germany.\"}}"

...

This command sends the data to create a new instance of an EditorialObject.

2. Read (GET)

To retrieve information about EditorialObject, use a GET request. Since reading may not necessarily require parameters for simple fetches, here's how you would structure the request:

Code Block
languagebash
curl -X GET http://localhost/enapso-dev/view-management/v1/editorialObject

...

...

3. Update (PUT)

To update an existing EditorialObject, use the following curl command to send a PUT request with the IRI and new values:

Code Block
languagebash
curl -X PUT "http://localhost/enapso-dev/view-management/v1/editorialObject" -H "Content-Type: application/json" -d "{\"variables\": {\"iri\": \"http://ont.enapso.com/sparql-template#EditorialObject_2f9b1462-e937-4416-8c23-ce96fc42dc55\", \"productionSynopsis\": \"Directed by Florian Henckel von Donnersmarck, this sweeping historical drama delves into themes of art, love, tragedy, and the inescapable impact of politics on personal lives.\"}}"

...

This command updates the specified EditorialObject's productionSynopsisbased on its IRI.

4. Delete (DELETE)

To delete an EditorialObject instance, use the following curl command to send a DELETE request:

Code Block
languagebash
curl -X DELETE "http://localhost/enapso-dev/view-management/v1/editorialObject" -H "Content-Type: application/json" -d "{\"variables\": {\"iri\": \"http://ont.enapso.com/sparql-template#EditorialObject_2f9b1462-e937-4416-8c23-ce96fc42dc55\"}}"

...

This command deletes the EditorialObject identified by the given IRI.

Summary

These curl commands provide a direct way to interact with your RESTful API, enabling you to perform create, read, update, and delete operations on EditorialObjects. Ensure that your API endpoints are secured and only accessible to authorized users to maintain data integrity and security.

...

These curl examples give users practical tools to interact with their REST APIs, providing a hands-on approach to managing data through programmatic access.

Summary

This setup enables you to fully utilize the RESTful interface of the ENAPSO together Free platform, integrating seamlessly with your existing workflows and enhancing data manipulation capabilities through programmatically accessible endpoints.

...