|
| 1 | +openapi: "3.0.3" |
| 2 | +info: |
| 3 | + title: "Officers" |
| 4 | + description: "API Description" |
| 5 | + version: "0.1.0" |
| 6 | +servers: |
| 7 | + - url: "http://dev-api.nationalpolicedata.org/api/v1" |
| 8 | + description: "Development environment" |
| 9 | + - url: "https://stage-api.nationalpolicedata.org/api/v1" |
| 10 | + description: "Staging environment" |
| 11 | + - url: "https://api.nationalpolicedata.org" |
| 12 | + description: "Production environment" |
| 13 | +x-readme: |
| 14 | + explorer-enabled: true |
| 15 | + proxy-enabled: true |
| 16 | + samples-enabled: true |
| 17 | +security: |
| 18 | + - bearerAuth: [] |
| 19 | +tags: |
| 20 | + - name: "Officers" |
| 21 | + description: "Officer related endpoints" |
| 22 | + - name: "Employment History" |
| 23 | + description: "Employment related endpoints" |
| 24 | +paths: |
| 25 | + /officers: |
| 26 | + get: |
| 27 | + tags: |
| 28 | + - "Officers" |
| 29 | + summary: "Get all officers" |
| 30 | + operationId: "getOfficers" |
| 31 | + parameters: |
| 32 | + - $ref: '../common/pagination.yaml#/components/parameters/page' |
| 33 | + - $ref: '../common/pagination.yaml#/components/parameters/per_page' |
| 34 | + responses: |
| 35 | + "200": |
| 36 | + description: "Successful operation" |
| 37 | + content: |
| 38 | + application/json: |
| 39 | + schema: |
| 40 | + $ref: "#/components/schemas/OfficerList" |
| 41 | + post: |
| 42 | + tags: |
| 43 | + - Officers |
| 44 | + summary: "Create a new officer" |
| 45 | + operationId: "createOfficer" |
| 46 | + requestBody: |
| 47 | + content: |
| 48 | + application/json: |
| 49 | + schema: |
| 50 | + $ref: "#/components/schemas/CreateOfficer" |
| 51 | + responses: |
| 52 | + '201': |
| 53 | + description: 'Successful operation' |
| 54 | + content: |
| 55 | + application/json: |
| 56 | + schema: |
| 57 | + $ref: '#/components/schemas/Officer' |
| 58 | + '400': |
| 59 | + $ref: '../common/error.yaml#/components/responses/validationError' |
| 60 | + /officers/{uid}: |
| 61 | + parameters: |
| 62 | + - name: uid |
| 63 | + in: path |
| 64 | + description: UID of the officer |
| 65 | + required: true |
| 66 | + schema: |
| 67 | + type: string |
| 68 | + get: |
| 69 | + tags: |
| 70 | + - "Officers" |
| 71 | + summary: "Get officer by uid" |
| 72 | + operationId: "getOfficerById" |
| 73 | + responses: |
| 74 | + "200": |
| 75 | + description: "Successful operation" |
| 76 | + content: |
| 77 | + application/json: |
| 78 | + schema: |
| 79 | + $ref: "#/components/schemas/Officer" |
| 80 | + '404': |
| 81 | + $ref: '../common/error.yaml#/components/responses/notFoundError' |
| 82 | + patch: |
| 83 | + tags: |
| 84 | + - "Officers" |
| 85 | + summary: "Update an existing officer" |
| 86 | + operationId: "updateOfficer" |
| 87 | + requestBody: |
| 88 | + description: "Officer object that needs to be updated" |
| 89 | + required: true |
| 90 | + content: |
| 91 | + application/json: |
| 92 | + schema: |
| 93 | + $ref: "#/components/schemas/Officer" |
| 94 | + responses: |
| 95 | + "200": |
| 96 | + description: "Successful operation" |
| 97 | + content: |
| 98 | + application/json: |
| 99 | + schema: |
| 100 | + $ref: "#/components/schemas/Officer" |
| 101 | + '400': |
| 102 | + $ref: '../common/error.yaml#/components/responses/validationError' |
| 103 | + delete: |
| 104 | + tags: |
| 105 | + - "Officers" |
| 106 | + summary: "Delete an officer" |
| 107 | + operationId: "deleteOfficer" |
| 108 | + description: "Delete an officer by uid" |
| 109 | + parameters: |
| 110 | + - name: "uid" |
| 111 | + in: "path" |
| 112 | + description: "UID of officer to delete" |
| 113 | + required: true |
| 114 | + schema: |
| 115 | + type: "integer" |
| 116 | + format: "int64" |
| 117 | + responses: |
| 118 | + "204": |
| 119 | + description: "No content" |
| 120 | + '404': |
| 121 | + $ref: '../common/error.yaml#/components/responses/notFoundError' |
| 122 | + /officers/{uid}/employment: |
| 123 | + parameters: |
| 124 | + - name: uid |
| 125 | + in: path |
| 126 | + description: UID of the officer |
| 127 | + required: true |
| 128 | + schema: |
| 129 | + type: string |
| 130 | + get: |
| 131 | + summary: "Get Employment History" |
| 132 | + operationId: "getEmploymentHistory" |
| 133 | + description: > |
| 134 | + Get employment history for an officer. This includes all the agencies |
| 135 | + the officer has worked for. |
| 136 | + tags: |
| 137 | + - "Employment History" |
| 138 | + responses: |
| 139 | + '200': |
| 140 | + description: 'Successful operation' |
| 141 | + content: |
| 142 | + application/json: |
| 143 | + schema: |
| 144 | + $ref: '#/components/schemas/EmploymentList' |
| 145 | + put: |
| 146 | + summary: "Update Employment History" |
| 147 | + operationId: "updateEmploymentHistory" |
| 148 | + description: > |
| 149 | + Update the employment history for an officer. This includes all the agencies |
| 150 | + the officer has worked for. |
| 151 | + tags: |
| 152 | + - "Employment History" |
| 153 | + requestBody: |
| 154 | + content: |
| 155 | + application/json: |
| 156 | + schema: |
| 157 | + $ref: '#/components/schemas/AddEmploymentList' |
| 158 | + responses: |
| 159 | + '200': |
| 160 | + description: 'Successful operation' |
| 161 | + content: |
| 162 | + application/json: |
| 163 | + schema: |
| 164 | + $ref: '#/components/schemas/EmploymentList' |
| 165 | + '400': |
| 166 | + $ref: '../common/error.yaml#/components/responses/validationError' |
| 167 | +components: |
| 168 | + securitySchemes: |
| 169 | + bearerAuth: |
| 170 | + type: http |
| 171 | + scheme: bearer |
| 172 | + bearerFormat: JWT |
| 173 | + schemas: |
| 174 | + BaseEmployment: |
| 175 | + type: "object" |
| 176 | + properties: |
| 177 | + officer_uid: |
| 178 | + type: "string" |
| 179 | + description: "The UID of the officer." |
| 180 | + agency_uid: |
| 181 | + type: "string" |
| 182 | + description: "The UID of the agency the officer is employed by." |
| 183 | + unit_uid: |
| 184 | + type: "string" |
| 185 | + description: "The UID of the unit the officer is assigned to." |
| 186 | + earliest_employment: |
| 187 | + type: "string" |
| 188 | + format: "date" |
| 189 | + description: "The earliest date of employment" |
| 190 | + latest_employment: |
| 191 | + type: "string" |
| 192 | + format: "date" |
| 193 | + description: "The latest date of employment" |
| 194 | + badge_number: |
| 195 | + type: "string" |
| 196 | + description: "The badge number of the officer" |
| 197 | + highest_rank: |
| 198 | + type: "string" |
| 199 | + description: "The highest rank the officer has held during this employment." |
| 200 | + commander: |
| 201 | + type: boolean |
| 202 | + description: Indicates that the officer commanded the unit during this employment. |
| 203 | + AddEmployment: |
| 204 | + allOf: |
| 205 | + - $ref: "#/components/schemas/BaseEmployment" |
| 206 | + - type: "object" |
| 207 | + - required: |
| 208 | + - unit_uid |
| 209 | + - badge_number |
| 210 | + AddEmploymentFailed: |
| 211 | + type: object |
| 212 | + properties: |
| 213 | + agency_uid: |
| 214 | + type: "string" |
| 215 | + description: "The uid of the agency that could not be added." |
| 216 | + reason: |
| 217 | + type: "string" |
| 218 | + description: "The reason the employment record could not be added" |
| 219 | + AddEmploymentList: |
| 220 | + type: object |
| 221 | + properties: |
| 222 | + agencies: |
| 223 | + type: "array" |
| 224 | + description: "The units to add to the officer's employment history." |
| 225 | + items: |
| 226 | + $ref: "#/components/schemas/AddEmployment" |
| 227 | + Employment: |
| 228 | + allOf: |
| 229 | + - $ref: "#/components/schemas/BaseEmployment" |
| 230 | + AddEmploymentResponse: |
| 231 | + type: object |
| 232 | + required: |
| 233 | + - created |
| 234 | + - failed |
| 235 | + - total_created |
| 236 | + - total_failed |
| 237 | + properties: |
| 238 | + created: |
| 239 | + type: array |
| 240 | + items: |
| 241 | + $ref: "#/components/schemas/Employment" |
| 242 | + failed: |
| 243 | + type: array |
| 244 | + items: |
| 245 | + $ref: "#/components/schemas/AddEmploymentFailed" |
| 246 | + total_created: |
| 247 | + type: integer |
| 248 | + minimum: 0 |
| 249 | + total_failed: |
| 250 | + type: integer |
| 251 | + minimum: 0 |
| 252 | + EmploymentList: |
| 253 | + allOf: |
| 254 | + - $ref: '../common/pagination.yaml#/components/schemas/PaginatedResponse' |
| 255 | + - type: "object" |
| 256 | + properties: |
| 257 | + results: |
| 258 | + type: "array" |
| 259 | + items: |
| 260 | + $ref: "#/components/schemas/Employment" |
| 261 | + BaseOfficer: |
| 262 | + type: "object" |
| 263 | + properties: |
| 264 | + first_name: |
| 265 | + type: "string" |
| 266 | + description: "First name of the officer" |
| 267 | + middle_name: |
| 268 | + type: "string" |
| 269 | + description: "Middle name of the officer" |
| 270 | + last_name: |
| 271 | + type: "string" |
| 272 | + description: "Last name of the officer" |
| 273 | + ethnicity: |
| 274 | + type: "string" |
| 275 | + description: "The ethnicity of the officer" |
| 276 | + enum: |
| 277 | + - American Indian or Alaska Native |
| 278 | + - Asian |
| 279 | + - Black or African American |
| 280 | + - Hispanic or Latino |
| 281 | + - Native Hawaiian or Other Pacific Islander |
| 282 | + - White |
| 283 | + gender: |
| 284 | + type: "string" |
| 285 | + description: "The gender of the officer" |
| 286 | + enum: |
| 287 | + - Male |
| 288 | + - Female |
| 289 | + - Other |
| 290 | + date_of_birth: |
| 291 | + type: "string" |
| 292 | + format: "date" |
| 293 | + description: "The date of birth of the officer" |
| 294 | + state_ids: |
| 295 | + type: "array" |
| 296 | + description: "The state ids of the officer" |
| 297 | + items: |
| 298 | + $ref: "#/components/schemas/StateId" |
| 299 | + CreateOfficer: |
| 300 | + allOf: |
| 301 | + - $ref: "#/components/schemas/BaseOfficer" |
| 302 | + - type: "object" |
| 303 | + - required: |
| 304 | + - first_name |
| 305 | + - last_name |
| 306 | + UpdateOfficer: |
| 307 | + allOf: |
| 308 | + - $ref: "#/components/schemas/BaseOfficer" |
| 309 | + - type: "object" |
| 310 | + Officer: |
| 311 | + allOf: |
| 312 | + - $ref: "#/components/schemas/BaseOfficer" |
| 313 | + - type: "object" |
| 314 | + - properties: |
| 315 | + uid: |
| 316 | + type: "string" |
| 317 | + description: "The uid of the officer" |
| 318 | + employment_history: |
| 319 | + type: "string" |
| 320 | + description: "A link to retrieve the employment history of the officer" |
| 321 | + allegations: |
| 322 | + type: "string" |
| 323 | + description: "A link to retrieve the allegations against the officer" |
| 324 | + litigation: |
| 325 | + type: "string" |
| 326 | + description: "A link to retrieve the litigation against the officer" |
| 327 | + OfficerList: |
| 328 | + allOf: |
| 329 | + - $ref: '../common/pagination.yaml#/components/schemas/PaginatedResponse' |
| 330 | + - type: "object" |
| 331 | + properties: |
| 332 | + results: |
| 333 | + type: "array" |
| 334 | + items: |
| 335 | + $ref: "#/components/schemas/Officer" |
| 336 | + StateId: |
| 337 | + type: "object" |
| 338 | + properties: |
| 339 | + uid: |
| 340 | + type: "string" |
| 341 | + description: "The UUID of this state id" |
| 342 | + state: |
| 343 | + type: "string" |
| 344 | + description: "The state of the state id" |
| 345 | + id_name: |
| 346 | + type: "string" |
| 347 | + description: "The name of the id. For example, Tax ID, Driver's License, etc." |
| 348 | + value: |
| 349 | + type: "string" |
| 350 | + description: "The value of the id." |
0 commit comments