Open FeXd opened 3 years ago
This is handy: https://publications.saskatchewan.ca/api/v1/products
This takes a very long time to return, but sends back a huge JSON dump of all pdocuts available. Specifying an ID will return just that data: https://publications.saskatchewan.ca/api/v1/products/113951
{
"productId": 113951,
"name": "Weekly Rainfall - August 2, 2021",
"nameFrench": null,
"shortDescriptionEnglish": "<p>Weekly Rainfall Map - August 2, 2021</p>",
"shortDescriptionFrench": null,
"longDescriptionEnglish": null,
"longDescriptionFrench": null,
"agencyId": 46,
"agency": {
"agencyId": 46,
"name": "Agriculture",
"description": "",
"agencyTypeId": 1,
"agencyType": {
"agencyTypeId": 1,
"description": "Government or External Agency",
"active": true
},
"minimumOrderPrice": 0.00,
"active": true,
"primaryAddress": {
"agencyAddressId": 45,
"agencyId": 46,
"agencyName": "Agriculture",
"addressLine1": "3085 Albert Street",
"addressLine2": "",
"city": "Regina",
"provinceCode": "SK",
"postalCode": "S4S0B1",
"countryCode": "CA",
"phoneNumber": "-",
"name": "Agriculture",
"isPrimary": true,
"gtdsUnitCode": "AG",
"url": "http://www.saskatchewan.ca/agriculture",
"email": null
},
"productCount": 3603,
"userCount": 8
},
"agencyBranchId": 46,
"agencyBranch": {
"agencyId": 46,
"name": "Agriculture",
"description": "",
"agencyTypeId": 1,
"agencyType": {
"agencyTypeId": 1,
"description": "Government or External Agency",
"active": true
},
"minimumOrderPrice": 0.00,
"active": true,
"primaryAddress": {
"agencyAddressId": 45,
"agencyId": 46,
"agencyName": "Agriculture",
"addressLine1": "3085 Albert Street",
"addressLine2": "",
"city": "Regina",
"provinceCode": "SK",
"postalCode": "S4S0B1",
"countryCode": "CA",
"phoneNumber": "-",
"name": "Agriculture",
"isPrimary": true,
"gtdsUnitCode": "AG",
"url": "http://www.saskatchewan.ca/agriculture",
"email": null
},
"productCount": 3603,
"userCount": 8
},
"productSubTypeId": 53,
"productSubType": {
"productSubTypeId": 53,
"productTypeId": 1,
"productType": {
"productTypeId": 1,
"description": "Document"
},
"description": "Document",
"active": true
},
"productStatusType": "ACTIVE",
"productFormatSortType": "DESCRIPTION",
"productPublicationDate": "2021-08-04",
"activeTimestamp": "2021-08-05T16:00:00Z",
"inactiveTimestamp": null,
"author": null,
"customIdentifier": null,
"contactAddressId": 45,
"contactAddress": {
"agencyAddressId": 45,
"agencyId": 46,
"agencyName": "Agriculture",
"addressLine1": "3085 Albert Street",
"addressLine2": "",
"city": "Regina",
"provinceCode": "SK",
"postalCode": "S4S0B1",
"countryCode": "CA",
"phoneNumber": "-",
"name": "Agriculture",
"isPrimary": true,
"gtdsUnitCode": "AG",
"url": "http://www.saskatchewan.ca/agriculture",
"email": null
},
"productNtsMaps": [
],
"productFormats": [
{
"productFormatId": 128247,
"productId": 113951,
"productFormatMediumType": "DIGITAL",
"productFormatType": "PDF",
"taxExemptionType": "NONE",
"isPrimary": true,
"productVersion": null,
"language": "English",
"description": null,
"price": 0.00,
"formatPublicationDate": null,
"activeTimestamp": "2021-08-04T19:24:57Z",
"inactiveTimestamp": null,
"pageCount": null,
"digitalAttributes": {
"productFormatDigitalId": 59043,
"productFormatId": 128247,
"fileName": "crprpt20210804a.pdf",
"contentType": "application/pdf",
"fileSize": 351611
}
}
],
"topics": null,
"productFormatCount": 1,
"productRelationCount": 0,
"productInfoCount": 0,
"productTopicCount": 1,
"productCategoriesCount": 1,
"popularity": 0.0
}
Attempted to hit: https://publications.saskatchewan.ca/api/v1/products/?agencyID=46
Received:
CitizenOne is a digital interaction broker designed to create a user-friendly and secure experience between a citizen and government. It allows government to broker access to sensitive services while protecting the citizen’s privacy and the security of their information.
Inspecting network traffic to attempt to figure out API.
After a recent comment on twitter, I started looking into if there was an official rain / precipitation report form the Government of Saskatchewan. The Ministry of Agriculture has two reports: https://www.saskatchewan.ca/business/agriculture-natural-resources-and-industry/agribusiness-farmers-and-ranchers/programs-and-services/information-services-for-agribusiness-farmers-and-ranchers/maps-for-farmers-and-agribusiness
The PDFs live in publications.saskatchewan.ca and are available via their API: https://publications.saskatchewan.ca/api/v1/products/113952/formats/128248/download
Look into how easy it would be to figure out the URL and regularly download.