RESTful API Integration Demos, Part 3 – Static API Key Authentication

Syndeia’s Generic RESTful API interface provides a powerful tool for adding new model repositories to a digital thread without customized coding by the vendor. With this post, we continue reviewing the RESTful API demo videos organized around each of five methods authenticating access to an external RESTful API-based repository: no authentication required, basic authentication, and bearer, API key, and dynamic token-based authentication. Part 3 references the video Demo 29.4 – Integrating RESTful Repositories with static API Key (Astra DB).

The video at the end of this blog follows a similar outline to the others in this series:

  1. Integrating AstraDB repository using API Key
  2. Adding RESTful Requests
    • Get keyspaces in a database
    • Get tables in a keyspace
    • Get rows in a table
    • Get a row using the primary key in a table

In addition to providing a demo on API key authentication, this video offers useful guidance on a) drilling down in any database to specific data elements and b) using the cloning function in Request generation to make this process more efficient.

DataStax Astra DB is a cloud-native database built on Apache Cassandra, allowing developers to provide it as a Database-as-a-Service. It provides a rich REST API specification. Click here for details. When a user obtains an account on Astra DB, they are provided with an API key with two parts: name and value.

Figure 1 shows the Create Repository link window that appears in the Syndeia Cloud Web Dashboard when a new RESTful repository is added. In this case, the user has added the url and selected API key for the Authentication type. At that point, fields for the Header Name and Value appear and the static API key details are added.

Repository link creation

Figure 1 Repository link creation (url and key value obscured)

The creation of Collections and Requests was discussed in Parts 1 and 2 of this series and the steps in Part 3 follow the same pattern. A set of Requests within the Default Collection has been created for this example. Figure 2 shows the form for the first request, Get all keyspaces.

One difference relative to the earlier examples is the inclusion of headers in the request, which are necessary for Syndeia Cloud to relay the request to the Astra DB repository correctly. In Figure 2, the Header Name, x-cassandra-token is the same as that provided by DataStax and entered in Figure 1. However, a placeholder value, Temp, is entered in the value field, which Syndeia will replace with the full value string when the Request is passed through. This must be included for all Requests.

Note also that the plus icon to the right of the header fields must be clicked to make sure the header is registered as part of the Request.

Structure for Astra DB key spaces

Figure 2 Request structure for Astra DB key spaces

The creation of the subsequent requests for

  • All tables in a selected keyspace
  • All rows in a selected table
  • A row selected by primary key in a selected table

are created successively by using the Clone Request feature. As the video demonstrates, this minimizes the entry of information with each new request as the header is retained and the endpoint can be appended as additional levels of the database are plumbed. In other words, the request for tables can be built on top of the request for keyspaces, the request for rows on top of that for tables, and so forth.

The final Request, shown in Figure 3, returns the contents of a specific row identified by its primary key (id), which was taken from results of the previous Requests for all rows from a specific keyspace and table. The row contains five fields: productname, description, price, id, and created[date]. Using Syndeia, this data is a) available for analysis, reporting and transfer to another model domain, and b) can be linked to with a reference connection as part of the digital thread.

Response to a Row Request

Figure 3 Response to a Row Request

The Generic RESTful API Integration introduced in Syndeia 3.5 enormously expanded the number of model and data repositories that could be added to the digital thread. Future parts of this blog series will cover additional demonstration videos with other RESTful API-based repositories and other API authentication mechanisms.

Demo: Integrating RESTful Repositories with static API Key (Astra DB)

Other parts in this series:

Dirk Zwemer

Dr. Dirk Zwemer (dirk.zwemer@intercax.com) is COO and Co-founder of Intercax LLC (Atlanta, GA), a supplier of MBE engineering software platforms like Syndeia and ParaMagic. He is an active teacher and consultant in the field and holds Level 4 Model Builder-Advanced certification as an OMG System Modeling Professional.