Target Endpoints
How Target data is saved and validated.
Target Details
'Targets' are endpoints the PresQT API will connect to such as OSF, CurateND, HubZero, etc. Since PresQT doesn't have a database, the Targets' information will be held in a JSON file located in /presqt/targets.json
.
Target JSON Values:
name : str
Name of the Target. This will be used as path parameters in the URL
readable_name : str
Human readable name of the Target for the front end.
supported_hash_algorithms : array
The hash algorithms supported by the target
supported_actions : dict
Actions the target supports
resource_collection : bool
Get all resources for the user
resource_detail : bool
Get an individual resource's details
resource_download : bool
Download a resource
resource_upload: bool
Upload a resource
resource_transfer: bool
Transfer a resource
Target JSON Example:
JSON Validation
We are using the JSON Schema library (https://json-schema.org/) to validated the Target JSON. Defining a JSON Schema for the Target JSON allows us to declare how the Target JSON should be structured. JSON Schema has a validation function where we can pass in a schema and JSON and it will return if the JSON is valid or not. The schema definition is located in /presqt/json_schemas/target_schema.json
.
Validation Calls
A management command has been written that will do Target JSON validation. It can be run manually by running:
This same management is called when docker-compose up
is ran. If the validation fails then it does not allow the docker containers to be spun up.
Target API Endpoints
pageTarget EndpointsLast updated