# SERPRO ## FrontController Contract Api A new set of api for managing contract that is used by FrontController. Using this api to create all the required resources rather than the negoitation process in our SDS. ### CreateContract POST /api/sharing/v1/front-controller/contracts RequestBody: | Name | Type | Required | Description | | -- | -- | -- | -- | | title | String | true | Title of the contract. | | description | String | false | Description of the contract. | | consumer_name | String | true | Name of the consumer that FrontController use to find the associate contract when handling an api request. | | ruleset | ObjectWithUUID[] | true | Rulesets that FrontController applies the rules when validating api request. | | datasets | ObjectWithUUID[] | true | Datasets that FrontContoller validates if the consumer has the permission to access the datatable. | | export_schemas | ExportSchema[] | true | Schemas that FrontController controls which fields in the api response could be returned to the consumer. | ObjectWithUUID: | Name | Type | Required | Description | | -- | -- | -- | -- | | uuid | String | true | | ExportSchema: | Name | Type | Required | Description | | -- | -- | -- | -- | | dataset_uuid | String | true | | | datatable_uuid | String | true | | | schema.schema | Schema[] | true | | Schema: | Name | Type | Required | Description | | -- | -- | -- | -- | | name | String | true | | | type | String | true | | | description | String | false | | | pii_sensitive | Boolean | false | | FrontControllerContract: | Name | Type | Required | Description | | -- | -- | -- | -- | | uuid | String | true | | | title | String | true | | | description | String | true | | | consumer_gateway_uuid | String | true | | | rulesets | Ruleset[] | true | | | datasets | Dataset[] | true | | | export_schemas | ExportSchema[] | true | | ResponseBody: Return all fields in FrontControllerContract as response body. ### ListContracts GET /api/sharing/v1/front-controller/contracts ResponseBody: | Name | Type | Required | Description | | -- | -- | -- | -- | | result | FrontControllerContract[] | true | | ### GetContract GET /api/sharing/v1/front-controller/contracts/{contract_uuid} ResponseBody: Return all fields in FrontControllerContract as response body. ### UpdateContract PUT /api/sharing/v1/front-controller/contracts/{contract_uuid} RequestBody: | Name | Type | Required | Description | | -- | -- | -- | -- | | title | String | true | | | description | String | false | | | consumer_gateway_uuid | String | true | | | ruleset | ObjectWithUUID[] | true | | | datasets | ObjectWithUUID[] | true | | | export_schemas | ExportSchema[] | true | | ResponseBody: Return all fields in FrontControllerContract as response body. ### DeleteContract DELETE /api/sharing/v1/front-controller/contracts/{contract_uuid} ResponseBody: | Name | Type | Required | Description | | -- | -- | -- | -- | | result | String | true | Result of the api request. | ## Dataset Api The dataset api is similar to SDS's api, the only difference is removing unnecessary fileds from request and response body. ### CreateDataset POST /api/sharing/v1/datasets RequestBody: | Name | Type | Required | Description | | -- | -- | -- | -- | | name | String | true | Name of the dataset. | | description | String | false | Description of the dataset. | | datatables | ObjectWithUUID[] | false | Datatables that contained in dataset. | Dataset: | Name | Type | Required | Description | | -- | -- | -- | -- | | uuid | String | true | UUID of the dataset. | | name | String | true | Name of the dataset. | | description | String | true | Description of the dataset. | | datatables | ObjectWithUUID[] | true | Datatables that contained in dataset. | ResponseBody: Return all fields in Dataset as response body. ### ListDatasets GET /api/sharing/v1/datasets ResponseBody: An array contains a list of Datasets. ### GetDataset GET /api/sharing/v1/datasets/{dataset_uuid} ResponseBody: Return all fields in Dataset as response body. ### UpdateDataset PUT /api/sharing/v1/datasets/{dataset_uuid} RequestBody: | Name | Type | Required | Description | | -- | -- | -- | -- | | name | String | true | | | description | String | false | | | datatables | ObjectWithUUID[] | false | | ResponseBody: Return all fields in Dataset as response body. ### DeleteDataset DELETE /api/sharing/v1/datasets/{dataset_uuid} ResponseBody: | Name | Type | Required | Description | | -- | -- | -- | -- | | result | String | true | Result of the api request. | ## Datatable Api The datatable api is similar to SDS's api, the differences are following: 1. Some of the unnecessary fields are removed. 2. A new defined datatable format "api" for representing a HTTP api. There is a restriction on this format of datatable's binding that it must be in format "[<HTTP_METHOD>]<HTTP_URL>", e.g. "[GET]https://localhost:5000/api/endpoint_a". ### CreateDatatable POST /api/sharing/v1/datatables RequestBody: | Name | Type | Required | Description | | -- | -- | -- | -- | | title | String | true | Name of the datatable. | | binding | String | true | A string that http method concates with url to represent which api does the datatable represent. | | description | String | false | Description of the datatable. | | schema | Schema[] | true | Schema of the datatable. | Datatable: | Name | Type | Required | Description | | -- | -- | -- | -- | | uuid | String | true | UUID of the datatable. | | title | String | true | Name of the datatable. | | binding | String | true | A string that http method concates with url to represent. | | description | String | true | Description of the datatable. | | schema | Schema[] | true | Schema of the datatable. | ResponseBody: Return all fields in Datatable as response body. ### ListDatatables GET /api/sharing/v1/datatables ResponseBody: An array contains a list of Datatables. ### GetDatatable GET /api/sharing/v1/datatables/{datatable_uuid} ResponseBody: Return all fields in Datatable as response body. ### UpdataDatatable PUT /api/sharing/v1/datatables/{datatable_uuid} RequestBody: | Name | Type | Required | Description | | -- | -- | -- | -- | | title | String | true | | | binding | String | true | | | description | String | true | | | schema | Schema[] | true | | ResponseBody: Return all fields in Datatable as response body. ### DeleteDatatable DELETE /api/sharing/v1/datatables/{datatable_uuid} ResponseBody: | Name | Type | Required | Description | | -- | -- | -- | -- | | result | String | true | Result of the api request. |