RADAR-base / RADAR-RestApi

RESTful interface to access near real-time data
Apache License 2.0
2 stars 0 forks source link

RADAR-CNS REST-API

Build Status Codacy Badge Codacy Badge

A REST-FULL Service using implemented using Jersey and deployed on Grizzly server. Thi project implements the downstream REST API for the RADAR-CNS project.

All the endpoints are secured and a valid user or a client registered with ManagementPortal with appropriate permissions/scopes can access the endpoints. For more details see [Management Portal] and [radar-auth]

Getting started

To run the application do:

By default, log messages are redirected to the STDOUT.

The api documentation is located at <your-server-address>:<port>/api/openapi.json

Access Control

For accessing the end-points of this API, you will need JWT tokens from the [Management Portal] (https://github.com/RADAR-CNS/ManagementPortal) and send it with each request in the header. In order for your token to allow access to the Rest-Api you will need to add the resource name of rest-api (ie - res_RestApi) in the oauth client details of the Management Portal(MP). For example, if you want a client named dashboard to have access to the REST API just add this line to the OAuth client credentials csv file of MP -

dashboard;res_RestApi;my-secret-token-to-change-in-production;SUBJECT.READ,PROJECT.READ,SOURCE
.READ,SOURCETYPE.READ,MEASUREMENT.READ;client_credentials;;;1800;3600;{};true

You can change the secret, scope, name, etc according to your needs. For more info, read the configuration in the Readme of Management Portal

The Rest-api is capable of reading bins.csv file generated while restructuring the HDFS file system. See hdfs_restructure.sh. This file gives a summary of records being received by the Radar Platform. An example of this file is included here in the root directory. Please place it in the /usr/local/tomcat/bin/radar/bins.csv for it to be readable by the RestApi. This is available at the end-point <your-server-address>:<port>/api/status/hdfs and can be obtained as a CSV or JSON as specified by the Accept header in your request.

Dev Environment

Click here to see documentation of dev deploy instance.

Clients

Swagger provides a tool to automatically generate a client in several programming language.

Integration test

Useful for testing the integration between RADAR-CNS Hotstorage , ManagementPortal and RADAR-CNS Rest API. Before running the test, add 127.0.0.1 hotstorage to the hosts file. To run the test:

  ./gradlew integrationTest

Contributing

Code should be formatted using the Google Java Code Style Guide. If you want to contribute a feature or fix, please make a pull request.