How to send requests to CREODIAS EODATA catalogue API using Firefox

The EODATA catalogue covered in EOData Catalogue API Manual on CREODIAS can be searched using standard HTTP requests. They return responses in JSON format.

This article covers how to send these request using Mozilla Firefox, a popular web browser. This piece of software includes a simple JSON parser which should make the responses legible.

This is especially useful if you, say, only have this Internet browser available to you and want to use catalogue API.

Prerequisites

No. 1 Firefox installed

You need to have Mozilla Firefox installed. You can download it from the official Mozilla website: https://www.mozilla.org. Many Linux distributions include this browser by default.

What We Are Going To Cover

  • Sending requests without body

  • Sending requests with body

Sending GET requests without body

Most requests described in EOData Catalogue API Manual on CREODIAS are simple GET requests which do not require including a body.

You can send them by simply entering URL from that article to the Firefox address bar. The browser should handle all special characters which these links might contain and convert them appropriately.

Firefox should return the response as parsed JSON. You can collapse a value using the down arrow found next to the key, for example:

../_images/send-requests-catalogue-01_creodias.png

After the value has been collapsed, it can be expanded again using the right arrow:

../_images/send-requests-catalogue-02_creodias.png

If you want to see unparsed JSON data, you can switch to tab Raw Data above:

../_images/send-requests-catalogue-03_creodias.png

Example

For example, let’s say that we want to access the following URL:

https://datahub.creodias.eu/odata/v1/Products?$filter=PublicationDate gt 2019-05-15T00:00:00.000Z and PublicationDate lt 2019-05-16T00:00:00.000Z

This URL shows products published between 15 May 2019 and 16 May 2019.

Part of parsed JSON will look as follows:

../_images/send-requests-catalogue-04_creodias.png

If you go to Raw Data, you can see the raw JSON:

../_images/send-requests-catalogue-05_creodias.png

Clicking Pretty Print should make this JSON more legible:

../_images/send-requests-catalogue-06_creodias.png

Sending requests with body

Some requests described in EOData Catalogue API Manual on CREODIAS require you to attach a body and use a different method.

You have such an example in section Query by list of that article - there you need to use POST method and attach a body.

To run this request using Firefox, first open a new tab and press CTRL+Shift+E (on Linux or Windows; on other operating systems this key combination might be different).

This should open the Network section of Developer Tools:

../_images/send-requests-catalogue-07_creodias.png

In the same tab, in the URL bar, access the URL found within that section (do not worry about attaching a body or changing the method yet). This URL is as follows:

https://datahub.creodias.eu/odata/v1/Products/OData.CSC.FilterList

This attempt should return an error:

../_images/send-requests-catalogue-08_creodias.png

In Developer Tools you previously opened, two requests should appear:

../_images/send-requests-catalogue-09_creodias.png

Right-click on request which has the following value in Initiator column: document.

From the drop-down menu choose Edit and Resend:

../_images/send-requests-catalogue-10_creodias.png

On the left, a new section should appear:

../_images/send-requests-catalogue-11_creodias.png

Here, you can change details of your request. Since we intend to use POST method, use the drop-down menu currently to the left of the URL within that section to choose that method:

../_images/send-requests-catalogue-12_creodias.png

In the text field Body enter the body which you want to attach to the URL.

In this example, it will be:

{
  "FilterProducts":
  [
     {"Name": "S1A_IW_GRDH_1SDV_20141031T161924_20141031T161949_003076_003856_634E.SAFE"},
     {"Name": "S3B_SL_1_RBT____20190116T050535_20190116T050835_20190117T125958_0179_021_048_0000_LN2_O_NT_003.SEN3"},
     {"Name": "xxxxxxxx.06.tar"}
  ]
 }

Once you have entered everything correctly, click Send:

../_images/send-requests-catalogue-13_creodias.png

Your new request should appear in the table. This time, it should have the following status: 200.

../_images/send-requests-catalogue-14_creodias.png

To the right of the table, you should find more details about this request:

../_images/send-requests-catalogue-15_creodias.png

In that section, check the Response tab. It should contain parsed JSON.

../_images/send-requests-catalogue-16_creodias.png

You can now use the arrow to expand this output:

../_images/send-requests-catalogue-17_creodias.png

As stated in EOData Catalogue API Manual on CREODIAS, you should see two products there:

../_images/send-requests-catalogue-18_creodias.png

If you want to copy full JSON response to the clipboard, right-click on the request in the table found within the central part of Developer Tools and choose Copy Value -> Copy Response:

../_images/send-requests-catalogue-19_creodias.png