Skip to content

pic sure api resources

Bria Morgan edited this page Aug 16, 2018 · 2 revisions

This module contains a submodule for every resource PICSURE-2.0 knows how to communicate with. The submodule pic-sure-resource-api contains the data objects, some utility classes, the ResourceWebClient, and the IResourceRS interface.

ResourceWebClient

This class is called by the Picsure services. It is an intermediary between the service layer and the resource services, so that RSs do not need to be installed in the same system. Any endpoints on any system that can handle Picsure requests can be called by the ResourceWebClient. Each method sends the request body to the URL sent to it and returns the response in a form recognized by Picsure.

IResourceRS

Any Resource Service that is to be used by Picsure needs to implement the IResourceRS interface.

Implementing a ResourceRS

Each ResourceRS should take in request that provide resource credentials, a URL of the resource, and any necessary data to pass to the request. The targetURL is the base URL of the resource. Each ResourceRS method should:

  • add its corresponding path to the targetURL
  • extract the credentials for the resource (if needed) and add them to the request
  • modify the request data to the format expected by the resource
  • interpret the response received from the resource and
    • map the status of the response (if applicable) to a PicSureStatus
    • format the response to the expected PICSURE-2.0 response object