|
| 1 | +# API Spec |
| 2 | + |
| 3 | +## List global projects |
| 4 | + |
| 5 | +Get a paginated list of global projects. |
| 6 | + |
| 7 | +**URL** : `/api/globalProjects` |
| 8 | + |
| 9 | +**Method** : `GET` |
| 10 | + |
| 11 | +**Auth required** : NO |
| 12 | + |
| 13 | +**Permissions required** : N/A |
| 14 | + |
| 15 | +**Query Parameters** : |
| 16 | +- `page`: Integer; Page number; Default: `1`; Optional |
| 17 | +- `limit`: Integer; Number of global projects per page; Default: `10`; Optional |
| 18 | +- `completed`: Boolean; Filter to return completed projects or not; Default: `false`; Optional |
| 19 | +- `region`: String; Filter to the projects matching specified region code; Default: `undefined`; Optional |
| 20 | + |
| 21 | +## Success Response |
| 22 | + |
| 23 | +**Code** : `200 OK` |
| 24 | + |
| 25 | +**Content examples** |
| 26 | + |
| 27 | +**Note** the contents of the `voting` and `demographics` columns are dependent on the region the project is associated with. Not every region will have political data (some may have no data or only data for 2016) or the full range of demographic data available (though every region _will_ have `demographics.population` at the least). |
| 28 | + |
| 29 | +```json |
| 30 | +{ |
| 31 | + "items": [ |
| 32 | + { |
| 33 | + "id": "UUID of a global project", |
| 34 | + "name": "Example project name", |
| 35 | + "numberOfDistricts": 10, |
| 36 | + "simplifiedDistricts": { |
| 37 | + "type": "FeatureCollection", |
| 38 | + "features": [ |
| 39 | + { |
| 40 | + "id": 0, |
| 41 | + "type": "Feature", |
| 42 | + "geometry": { |
| 43 | + "type": "MultiPolygon", |
| 44 | + "coordinates": [... |
| 45 | + ] |
| 46 | + }, |
| 47 | + "properties": { |
| 48 | + "voting": { |
| 49 | + "democrat16": 0, |
| 50 | + "republican16": 0, |
| 51 | + "other party16": 0, |
| 52 | + "democrat20": 0, |
| 53 | + "republican20": 0, |
| 54 | + "other party20": 0 |
| 55 | + }, |
| 56 | + "contiguity": "", |
| 57 | + "compactness": 0, |
| 58 | + "demographics": { |
| 59 | + "VAP": 0, |
| 60 | + "CVAP": 0, |
| 61 | + "asian": 0, |
| 62 | + "black": 0, |
| 63 | + "white": 0, |
| 64 | + "native": 0, |
| 65 | + "pacific": 0, |
| 66 | + "hispanic": 0, |
| 67 | + "VAP Asian": 0, |
| 68 | + "VAP Black": 0, |
| 69 | + "VAP White": 0, |
| 70 | + "CVAP Asian": 0, |
| 71 | + "CVAP Black": 0, |
| 72 | + "CVAP White": 0, |
| 73 | + "VAP Native": 0, |
| 74 | + "population": 0, |
| 75 | + "CVAP Native": 0, |
| 76 | + "VAP Pacific": 0, |
| 77 | + "CVAP Pacific": 0, |
| 78 | + "VAP Hispanic": 0, |
| 79 | + "CVAP Hispanic": 0 |
| 80 | + } |
| 81 | + } |
| 82 | + }, |
| 83 | + ... |
| 84 | + ], |
| 85 | + "metadata": { |
| 86 | + "creator": { |
| 87 | + "id": "UUID of user", |
| 88 | + "name": "Example user name" |
| 89 | + }, |
| 90 | + "completed": true, |
| 91 | + "regionConfig": { |
| 92 | + "id": "UUID of config", |
| 93 | + "name": "Example region config name", |
| 94 | + "s3URI": "s3://path/to/example/config/location", |
| 95 | + "regionCode": "Example region code", |
| 96 | + "countryCode": "Example country code" |
| 97 | + } |
| 98 | + } |
| 99 | + }, |
| 100 | + "createdDt": "2022-06-24T00:00:00.000Z", |
| 101 | + "updatedDt": "2022-06-24T00:00:00.000Z", |
| 102 | + "submittedDt": null, |
| 103 | + "regionConfig": { |
| 104 | + "id": "UUID of config", |
| 105 | + "name": "Example region config name", |
| 106 | + "s3URI": "s3://path/to/example/config/location", |
| 107 | + "archived": false |
| 108 | + }, |
| 109 | + "user": { |
| 110 | + "id": "UUID of user", |
| 111 | + "name": "Example user name" |
| 112 | + }, |
| 113 | + "chamber": null |
| 114 | + }, |
| 115 | + ... |
| 116 | + ], |
| 117 | + "meta": { |
| 118 | + "totalItems": 70, |
| 119 | + "itemCount": 8, |
| 120 | + "itemsPerPage": 8, |
| 121 | + "totalPages": 9, |
| 122 | + "currentPage": 1 |
| 123 | + } |
| 124 | +} |
| 125 | +``` |
0 commit comments