|
| 1 | +# KONG API Service Portal Setup |
| 2 | + |
| 3 | +The public API is accessible at |
| 4 | + |
| 5 | +* DEV: https://dev.strdata.api.gov.bc.ca |
| 6 | +* UAT: https://test.strdata.api.gov.bc.ca |
| 7 | +* PROD: https://strdata.api.gov.bc.ca |
| 8 | + |
| 9 | +API access is controlled via Kong, administered via the BC Gov API Programme Services API Gateway. |
| 10 | +**Kong configuration is not updated via Github Actions, and must be updated manually when there are changes.** |
| 11 | + |
| 12 | +For an overview of the API Gateway update process, see: |
| 13 | +https://bcgov.github.io/aps-infra-platform/guides/owner-journey-v1/ |
| 14 | + |
| 15 | + |
| 16 | +## Publication |
| 17 | + |
| 18 | +### Prerequisites |
| 19 | +1. In the API Services Portal (https://api.gov.bc.ca/), the namespace strdata has already been created. |
| 20 | +2. In the namespace, authorization profile has been created as follows: |
| 21 | + * Flow: Client Credential Flow, using Client ID and Secret |
| 22 | + * Mode: Automatic |
| 23 | + * Client Mappers (Audience): gateway-awp |
| 24 | + |
| 25 | + |
| 26 | +### Publication |
| 27 | + |
| 28 | + |
| 29 | +1. Log into https://api.gov.bc.ca/ |
| 30 | +2. Select the strdata namespace |
| 31 | +3. Create a service account with `GatewayConfig.Publish` scope and note down the client id and client secret |
| 32 | +4. Download the GWA CLI from https://github.com/bcgov/gwa-cli/releases |
| 33 | +5. In command prompt run the following commands (the first command create a .env file locally, which will need to be deleted if you need to create one for the other environment): |
| 34 | + |
| 35 | + ```sh |
| 36 | + gwa config set host api.gov.bc.ca |
| 37 | + gwa config set --namespace strdata |
| 38 | + |
| 39 | + export SCID="<<client id>>" |
| 40 | + export SCSC="<<client secret>>" |
| 41 | + export SURL="https://authz.apps.gov.bc.ca/auth/realms/aps/protocol/openid-connect/token" |
| 42 | + |
| 43 | + gwa login --client-id $SCID --client-secret $SCSC |
| 44 | + gwa pg strdata-{env}.yaml |
| 45 | + ``` |
| 46 | +5. (optional for Windows GWA) In command prompt of Windows run the following commands (the first command create a .env file locally, which will need to be deleted if you need to create one for the other environment): |
| 47 | + |
| 48 | + ```sh |
| 49 | + gwa config set host api.gov.bc.ca |
| 50 | + gwa config set --namespace strdata |
| 51 | + gwa login --client-id "<<client id>>" --client-secret "<<client secret>>" |
| 52 | + gwa pg strdata-{env}.yaml |
| 53 | + ``` |
| 54 | +6. Check the Gateway in the API Service Portal to make sure that the routes have been published |
| 55 | +7. Create a dataset if it doesn't exist. |
| 56 | + |
| 57 | + https://bcgov.github.io/aps-infra-platform/guides/owner-journey-v1/#91-setup-your-draft-dataset |
| 58 | + |
| 59 | + ``` |
| 60 | + { |
| 61 | + "name": "strdata-dataset", |
| 62 | + "license_title": "Open Government Licence - British Columbia", |
| 63 | + "security_class": "PUBLIC", |
| 64 | + "view_audience": "Public", |
| 65 | + "download_audience": "Public", |
| 66 | + "record_publish_date": "2024-09-11", |
| 67 | + "notes": "Short-Term Rental Data API Services", |
| 68 | + "title": "Short-Term Rental Data API Services", |
| 69 | + "tags": [ |
| 70 | + "openapi", |
| 71 | + "standards" |
| 72 | + ], |
| 73 | + "organization": "ministry-of-housing", |
| 74 | + "organizationUnit": "planning-and-land-use-management" |
| 75 | + } |
| 76 | + ``` |
| 77 | + |
| 78 | +8. Create a product if it doesn't exist. |
| 79 | + |
| 80 | +### Consumer Request & Approval |
| 81 | + |
0 commit comments