Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

This is the first hands-on exercise to learn about the Syndeia RESTful Integration capability introduced in Syndeia 3.5.

In this exercise, we will use the open-source SpaceX Data REST API that provides endpoints to fetch data about SpaceX rockets, launches, ships, star links, and other missions.

Objectives

The learning objectives of this exercise are as follows:

  1. Add a new RESTful repository in the Syndeia Web Dashboard

  2. Add new requests to fetch data from the RESTful repository

  3. View and browse responses to the requests

  4. Organize requests into collections

  5. Edit, clone, and delete requests

Preparation

This exercise assumes that the student has done the following preparations.

  1. Reviewed the content presented in Introduction to REST APIs and Syndeia RESTful Integration

  2. Able to access Syndeia Cloud 3.5 with a valid user account

  3. User account in Syndeia Cloud 3.5 has RESTFUL WRITE permission (contact Syndeia Cloud admin to verify)

Exercise

1/ Login to the Syndeia Cloud Web Dashboard and select the Repositories menu on the menu bar.


2/ Point to the RESTful repository type and select the + icon next to it to add a new RESTful repository, as shown in Figure 2 below.

Creating a new RESTful repository in Syndeia implies that you are connecting to an existing enterprise tool or service via its RESTful API.


3/ In the Create repository form, specify the following values for the fields.

  • Repository type = RESTful (already selected)

  • URL = https://api.spacexdata.com/v3

  • Name = SpaceX Data

  • Description = SpaceX Data RESTful repository.

  • Authentication Type = None

It is helpful to give meaningful names and descriptions to your repositories so that you can easily identify them later. You can use set the name and description fields in the form above to other values.


4/ Click on the Create button.


5/ You should see the new SpaceX Data repository listed under the RESTful repository type. Select the SpaceX Data repository. It should show up in the Tree View on the RHS.


6/ Expand the SpaceX Data repository in the Tree View. It will take a few seconds to initialize and show a default collection named Default RESTful Request Collection when expanded.

Collections are logical groupings of Requests. You can use them to organize Requests. Think of them as folders except that a Request can be a part of multiple Collections. A default Collection is made available when you add a new RESTful repository.


7/ Right-click on the Default RESTful Request Collection (or the SpaceX Data repository) in the Tree View and select Manage RESTful Collections and Requests.


8/ The Collections and Requests panel is the single panel to manage all the Collections and Requests for the given RESTful repository. You will use this panel to create, edit, clone, or delete Collections and Requests. This panel contains two tabs: Collections and Requests. The number on each tab shows the number of Collections and Requests that are defined for the given RESTful repository. In the initial state, there is 1 Collection (remember the Default RESTful Request Collection from previous steps) and 0 Requests.


9/ Click the Requests tab and then click on the + Add button. You will see an empty form to create a new Request, as shown in Figure 8 below.


10/ In the Create Request form, specify the following values for the fields.

  • Name = Get all Rockets

  • Description = Request to get all Rockets

  • Method = GET (selected by default)

  • URL = https://api.spacexdata.com/v3/rockets

    • The URL for the RESTful repository (https://api.spacexdata.com/v3) with a forward slash (/) is already filled out.

    • You will add rockets to that URL path, as shown in the figure below.


11/ Click the Test button. Syndeia will send the request to the RESTful repository and if successful the response will be shown in a green box, as shown in the figure below. The response is in the JSON format, which is the most common data format for RESTful APIs.

It is a good idea to test a Request before creating it. Testing a request verifies that the URL and other details in the Request are specified correctly.


12/ Click the Save button. You should see a green-colored message dialog stating Request created successfully. The Request should show in the table under the Requests tab of the Collections and Requests panel.


13/ Click on the X button on the top RHS of the Collections and Requests panel, as shown in the figure above.


14/ Expand the Default RESTful Request Collection. The new request Get all Rockets was added to the default collection since we did not specify a collection when creating the request. This request is a GET request and hence it is shown with a G icon.


15/ Expand the Get all Rockets request (G icon). Syndeia will send the request to the RESTful repository and if successful, the response will be shown under the request. In the figure shown below, the Request was successful and the resulting response includes data for 4 rockets.

The response is shown with the following details.

  • The square bracket [ ] icon indicates that the response is an array

  • The text Response from [GET ‘rockets’] indicates that this is the response from the GET Request sent to the rockets endpoint. See the URL for the Request in Step 11 above.

  • The number (4) next to the response indicates the number of members in that response (4 rockets in this case).


16/ Expand Response from [GET ‘rockets’] (4). You will see data for each of the 4 rockets.

Curly brace icon { } indicates that the data is a JSON object (key-value pairs). The number (23) indicates that the object includes 23 key-value pairs, or 23 fields with values.


17/ Expand the data for the first rocket. You will see all the 23 key-value pairs. The name of this rocket is Falcon 1 (rocket_name) and the id of this rocket is falcon1 (rocket_id).

Responses are shown with the following icons that match standard JSON syntax

  • Square brackets [ ] indicate arrays of JSON objects

  • Curly braces { } indicate a single JSON object with key-value pairs

  • “ “ indicate primitive data, e.g. Strings, Integers, Booleans, Float/Double, etc.


18/ Now, let’s add another request to get all the SpaceX payloads. To do this, launch the Collections and Requests panel by right-clicking the SpaceX Data repository (or the default Collection or the Get all Rockets Request) in the Tree View (Hint: See Step 7) and click on the Requests tab.


19/ The Request to get all payloads is similar to the one to get all rockets. So, we will clone the Get all Rockets Request and modify it. Click on the Clone icon shown under the Actions columns of the Get all Rockets row.

  • No labels