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": "putpatch",
                          "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 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. For example, http://localhost/enapso-dev/view-management${baseURL}/${endpoint} will become http://localhost/enapso-dev/view-management/v1/editorialObject.

        • 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. 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 Removedcreate-endpoint-request.pngImage Added

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

    route request.pngImage Removedcreate-endpoint-request-response.pngImage Added

Removing REST API endpoints via OpenAPI

  1. Find the delete-endpoint-of-template endpoint, which is used for removing existing REST APIs of 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 remove REST endpoints of the EditorialObject class:

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

      • records: This array holds one or more configuration objects.

        • endpoint: This string specifies the name of the endpoint. It acts as a part of the URL path where the API is 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 is grouped. For instance, "/v1" indicates that the endpoint is to be accessed under the version 1 group, forming part of the complete URL path. For example, <http://localhost/enapso-dev/view-management${baseURL}/${endpoint}> will become <http://localhost/enapso-dev/view-management/v1/editorialObject.>

        • endpointConfig: An array of objects where each object specifies a CRUD operation and the associated template that needs to be removed.

          • method: The HTTP method (e.g., "get", "post", "put", "delete") that determines what kind of operation needs to be removed. 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 as we create one method for each template name which is called when we send a request on that REST method so as to remove that method.

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

    delete endpoint.pngImage Removeddelete-endpoint-request.pngImage Added

  5. The response will indicate success, confirming that the endpoints are removed.

    delete endpoint response.pngImage Removeddelete-endpoint-request-response.pngImage Added

Managing REST API Endpoints via Command Line (curl)

...

Code Block
languagebash
curl --get "http://localhost/enapso-dev/view-management/v1/editorialObject"   --data-urlencode "filter.title=Run Lola Run"    --data-urlencode "filter.%3Chttp%3A%2F%2Fwww.ebu.ch%2Fmetadata%2Fontologies%2Febucoreplus%23hasRelatedEditorialObject%3E=http://www.ebu.ch/metadata/ontologies/ebucoreplus/data/Asset_37f6d90c-87c9-4c1f-9a46-ff1102f9bd8a"

Screenshot 2024-05-16 134257.png

3. Update (

...

PATCH)

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

...