This test case will check if any JWT-authenticated entity can open discover published service APIs.
**Pre-Conditions**:
* Service APIs are published.
* Provider was registered previously.
**Execution Steps**:
1. Register Provider at CCF, store certificates and Publish Service API at CCF.
2. Open Discover Service APIs using JWT token.
**Information of Test**:
1. Perform [Provider Registration]
2. Publish Service API at CCF:
* Send **POST** to ccf_publish_url **https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis**
* body [service api description] with apiName **service_1**
* Use **APF Certificate**
3. Request Open Discover Published APIs:
* Send **GET** to **https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis**
* No query parameters required
* Use **JWT Bearer Token**
**Expected Result**:
1. Response to Publish request must accomplish:
1.**201 Created**
2. Response Body must follow **ServiceAPIDescription** data structure with:
* apiId
3. Response Header **Location** must be received with URI to new resource created, following this structure: **{apiRoot}/published-apis/v1/{apfId}/service-apis/{serviceApiId}**
2. Response to Open Discover Request:
1.**200 OK** response.
2. Response body must follow **OpenDiscoveryResp** data structure:
* Check if `discApis` contains the API published previously.
## Test Case 2: Open Discover Published service APIs by Non Authorised Entity
This test case will check that a request without a valid JWT token is rejected with 401 Unauthorized.
**Pre-Conditions**:
* Service APIs are published.
**Execution Steps**:
1. Register Provider at CCF, store certificates and Publish Service API at CCF.
2. Request Open Discover without JWT token.
**Information of Test**:
1. Perform [Provider Registration]
2. Publish Service API at CCF:
* Send **POST** to ccf_publish_url **https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis**
* body [service api description] with apiName **service_1**
* Use **APF Certificate**
3. Request Open Discover Published APIs without authorization:
* Send **GET** to **https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis**
* No `Authorization` header
**Expected Result**:
1. Response to Publish request must accomplish:
1.**201 Created**
2. Response Body must follow **ServiceAPIDescription** data structure with:
* apiId
3. Response Header **Location** must be received with URI to new resource created, following this structure: **{apiRoot}/published-apis/v1/{apfId}/service-apis/{serviceApiId}**
2. Response to Open Discover Request:
1.**401 Unauthorized**
2. Error Response Body must accomplish with **ProblemDetails** data structure with:
* status 401
* title with message "Unauthorized"
* detail with message "User not authorized".
* cause with message "Certificate not authorized".
## Test Case 3: Open Discover Published service APIs when no APIs are published
This test case will check if an authenticated entity can filter open discovered service APIs by API name and obtain only the matching result.
**Pre-Conditions**:
* At least 2 Service APIs are published.
**Execution Steps**:
1. Register Provider at CCF, store certificates and Publish Service APIs **service_1** and **service_2** at CCF.
2. Open Discover all Service APIs.
3. Open Discover filtered by api-names **service_1**.
**Information of Test**:
1. Perform [Provider Registration]
2. Publish Service API at CCF:
* Send **POST** to ccf_publish_url **https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis**
* body [service api description] with apiName **service_1**
* Use **APF Certificate**
3. Publish Service API at CCF:
* Send **POST** to ccf_publish_url **https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis**
* body [service api description] with apiName **service_2**
* Use **APF Certificate**
4. Request Open Discover Published APIs:
* Send **GET** to **https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis**
* Use **JWT Bearer Token**
5. Request Open Discover filtering by api-names:
* Send **GET** to **https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis?api-names=service_1**
* Use **JWT Bearer Token**
**Expected Result**:
1. Response to each Publish request must accomplish:
1.**201 Created**
2. Response Body must follow **ServiceAPIDescription** data structure with:
* apiId
3. Response Header **Location** must be received with URI to new resource created, following this structure: **{apiRoot}/published-apis/v1/{apfId}/service-apis/{serviceApiId}**
2. Response to Open Discover Request (no filter):
1.**200 OK** response.
2. Response body must follow **OpenDiscoveryResp** data structure:
* Check if `discApis` contains the 2 previously published Service APIs.
3. Response to Open Discover Request (filtered by api-names=service_1):
1.**200 OK** response.
2. Response body must follow **OpenDiscoveryResp** data structure:
* Check if `discApis` contains **only** the API published with api-name **service_1**.
## Test Case 5: Open Discover Published service APIs filtered by api-names with no match
This test case will check that filtering by an api-name that does not match any published API returns 404 Not Found.
**Pre-Conditions**:
* At least 2 Service APIs are published.
**Execution Steps**:
1. Register Provider at CCF, store certificates and Publish Service APIs **service_1** and **service_2** at CCF.
2. Open Discover all Service APIs.
3. Open Discover filtered by api-names **NOT_VALID_NAME**.
**Information of Test**:
1. Perform [Provider Registration]
2. Publish Service API at CCF:
* Send **POST** to ccf_publish_url **https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis**
* body [service api description] with apiName **service_1**
* Use **APF Certificate**
3. Publish Service API at CCF:
* Send **POST** to ccf_publish_url **https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis**
* body [service api description] with apiName **service_2**
* Use **APF Certificate**
4. Request Open Discover Published APIs:
* Send **GET** to **https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis**
* Use **JWT Bearer Token**
5. Request Open Discover filtering by non-existent api-name:
* Send **GET** to **https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis?api-names=NOT_VALID_NAME**
* Use **JWT Bearer Token**
**Expected Result**:
1. Response to each Publish request must accomplish:
1.**201 Created**
2. Response Body must follow **ServiceAPIDescription** data structure with:
* apiId
3. Response Header **Location** must be received with URI to new resource created, following this structure: **{apiRoot}/published-apis/v1/{apfId}/service-apis/{serviceApiId}**
2. Response to Open Discover Request (no filter):
1.**200 OK** response.
2. Response body must follow **OpenDiscoveryResp** data structure:
* Check if `discApis` contains the 2 previously published Service APIs.
3. Response to Open Discover Request (filtered by api-names=NOT_VALID_NAME):
1.**404 Not Found** response.
2. Error Response Body must accomplish with **ProblemDetails** data structure with:
* status 404
* title with message "Not Found"
* detail with message "No API Published accomplish filter conditions".
* cause with message "No API Published accomplish filter conditions".
## Test Case 6: Open Discover Published service APIs not filtered
This test case will check if an authenticated entity can open discover all published service APIs without applying any filter.
**Pre-Conditions**:
* 2 Service APIs are published.
**Execution Steps**:
1. Register Provider at CCF, store certificates and Publish Service APIs **service_1** and **service_2** at CCF.
2. Open Discover all Service APIs without filter.
**Information of Test**:
1. Perform [Provider Registration]
2. Publish Service API at CCF:
* Send **POST** to ccf_publish_url **https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis**
* body [service api description] with apiName **service_1**
* Use **APF Certificate**
3. Publish Service API at CCF:
* Send **POST** to ccf_publish_url **https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis**
* body [service api description] with apiName **service_2**
* Use **APF Certificate**
4. Request Open Discover Published APIs not filtered:
* Send **GET** to **https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis**
* Use **JWT Bearer Token**
**Expected Result**:
1. Response to each Publish request must accomplish:
1.**201 Created**
2. Response Body must follow **ServiceAPIDescription** data structure with:
* apiId
3. Response Header **Location** must be received with URI to new resource created, following this structure: **{apiRoot}/published-apis/v1/{apfId}/service-apis/{serviceApiId}**
2. Response to Open Discover Request:
1.**200 OK** response.
2. Response body must follow **OpenDiscoveryResp** data structure:
* Check if `discApis` contains the 2 previously published Service APIs.
[service api description]:../api_publish_service/service_api_description_post_example.json"Service API Description Request"