-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathopenapi.yml
More file actions
9541 lines (9451 loc) · 295 KB
/
openapi.yml
File metadata and controls
9541 lines (9451 loc) · 295 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
info:
title: OPRE OPS API
description: OPRE OPS API Specification
version: 0.1.1
servers:
- url: https://localhost:8080/api/v1
description: OPS API Localhost
- url: https://dev.ops.opre.acf.gov/api/v1/
description: OPS API Development Server (Live)
- url: https://stg.ops.opre.acf.gov/api/v1/
description: OPS API Staging Server (Live)
- url: https://ops.opre.acf.gov/api/v1/
description: OPS API Production Server (Live)
tags:
- name: Agreements
description: Everything having to do with agreements
- name: Procurement Actions
description: Procurement actions for agreements (similar to MAPS AAP)
- name: Procurement Trackers
description: Procurement trackers for tracking the workflow of procurement actions
- name: Procurement Tracker Steps
description: Individual workflow steps within procurement trackers
- name: Lookups
description: Lookup endpoints for enum values and reference data
paths:
/agreements/:
get:
tags:
- Agreements
operationId: Get Agreements
description: Get a list of agreements
parameters:
- in: query
name: fiscal_year
schema:
type: array
items:
type: integer
style: form
explode: true
- in: query
name: budget_line_status
schema:
type: array
items:
type: string
style: form
explode: true
- in: query
name: portfolio
schema:
type: array
items:
type: integer
style: form
explode: true
- in: query
name: project_id
schema:
type: array
items:
type: integer
style: form
explode: true
- in: query
name: agreement_reason
schema:
type: array
items:
type: string
style: form
explode: true
- in: query
name: agreement_type
schema:
type: array
items:
type: string
style: form
explode: true
- in: query
name: name
schema:
type: array
items:
type: string
style: form
explode: true
- in: query
name: nick_name
description: Nickname to filter agreements by
schema:
type: string
style: form
- in: query
name: search
description: Search terms for finding agreements by name (case-insensitive)
schema:
type: array
items:
type: string
style: form
explode: true
- in: query
name: only_my
description: Only includes agreements that a user owns
schema:
type: boolean
style: form
- in: query
name: exact_match
description: >
When true, forces exact matching on agreement names instead of partial matching.
Only applies when filtering by agreement name. Default is true (exact match).
schema:
type: boolean
default: true
style: form
- in: query
name: sort_conditions
description: A list of conditions used to sort agreement results
schema:
type: array
items:
type: string
style: form
explode: true
- in: query
name: sort_descending
description: >
Sort agreements ascending or descending based on sort_conditions.
Has no effect if sort_conditions is not specified.
schema:
type: boolean
style: form
- in: query
name: limit
description: Maximum number of agreements to return
schema:
type: integer
default: 10
style: form
- in: query
name: offset
description: Number of agreements to skip before returning results
schema:
type: integer
default: 0
style: form
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
oneOf:
- $ref: "#/components/schemas/AgreementResponse"
- $ref: "#/components/schemas/ContractAgreementResponse"
- $ref: "#/components/schemas/GrantAgreementResponse"
- $ref: "#/components/schemas/DirectAgreementResponse"
- $ref: "#/components/schemas/IaaAgreementResponse"
- $ref: "#/components/schemas/AaAgreementResponse"
count:
type: integer
description: Total number of agreements matching the query
limit:
type: integer
description: Maximum number of agreements returned
offset:
type: integer
description: Number of agreements skipped
totals:
type: object
description: Aggregate totals across all matching agreements
properties:
count:
type: integer
description: Total count of agreements
obligated:
type: number
format: float
description: Total obligated amount
fees:
type: number
format: float
description: Total fees
in_draft:
type: number
format: float
description: Total in draft status
planned:
type: number
format: float
description: Total planned amount
executing:
type: number
format: float
description: Total executing amount
required:
- data
- count
- limit
- offset
- totals
"400":
description: Bad Request
"500":
description: Internal Server Error
post:
tags:
- Agreements
operationId: Create Agreement
summary: Create a new agreement with optional nested entities
description: |
Create a new agreement with optional budget line items and services components
in a single atomic operation. All operations are performed within a single
database transaction - if any part fails, the entire operation is rolled back.
## Nested Entity Creation
You can create the following entities atomically:
- Agreement (required)
- Budget Line Items (optional array)
- Services Components (optional array)
## Budget Line Item to Services Component Linking
Budget line items can reference services components in two ways:
1. `services_component_id`: Reference an existing services component by database ID
2. `services_component_ref`: Reference a services component being created in the
same request by its `ref` field value
## Services Component References
- Each services component can have a `ref` field (string) for identification
- Budget line items reference these using `services_component_ref`
- If no `ref` is provided, the array index (as a string) is used: "0", "1", etc.
## Backward Compatibility
Omitting `budget_line_items` and `services_components` creates an agreement
without nested entities, maintaining full backward compatibility.
## Error Handling
- Returns 400 for validation errors (e.g., invalid `services_component_ref`)
- Returns 404 for missing references (e.g., invalid `can_id`)
- On error, all changes are rolled back (no partial data created)
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/AgreementData"
- $ref: "#/components/schemas/ContractAgreementData"
- $ref: "#/components/schemas/GrantAgreementData"
- $ref: "#/components/schemas/DirectAgreementData"
- $ref: "#/components/schemas/IaaAgreementData"
- $ref: "#/components/schemas/AaAgreementData"
examples:
"0":
$ref: "#/components/examples/simple_agreement"
"1":
$ref: "#/components/examples/with_budget_line_items"
"2":
$ref: "#/components/examples/full_atomic_creation"
responses:
"201":
description: Created
content:
application/json:
schema:
type: object
required:
- message
- id
- budget_line_items_created
- services_components_created
properties:
message:
type: string
description: |
Human-readable success message. Examples:
- "Agreement created"
- "Agreement created with 2 budget line items"
- "Agreement created with 3 services components"
- "Agreement created with 2 budget line items and 3 services components"
id:
type: integer
description: ID of the created agreement
budget_line_items_created:
type: integer
description: Number of budget line items created (0 if none)
services_components_created:
type: integer
description: Number of services components created (0 if none)
"400":
description: Bad Request
"401":
description: Unauthorized
"404":
description: Not Found
"500":
description: Internal Server Error
/agreements/{id}:
get:
tags:
- Agreements
operationId: Get Agreement
description: Get a specific agreement by ID with fiscal year context
parameters:
- in: path
name: id
required: true
schema:
type: integer
description: Agreement ID
- in: query
name: fiscal_year
schema:
type: integer
description: |
Fiscal year for budget calculations and fiscal year-specific data.
If not provided, defaults to the current fiscal year.
responses:
"200":
description: OK
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/AgreementResponse"
- $ref: "#/components/schemas/ContractAgreementResponse"
- $ref: "#/components/schemas/GrantAgreementResponse"
- $ref: "#/components/schemas/DirectAgreementResponse"
- $ref: "#/components/schemas/IaaAgreementResponse"
- $ref: "#/components/schemas/AaAgreementResponse"
"400":
description: Bad Request - Invalid fiscal_year parameter
"404":
description: Not Found
"500":
description: Internal Server Error
put:
tags:
- Agreements
operationId: Update Agreement (Full)
description: |
Fully replace an existing agreement. All fields must be provided.
Budget line items and services components cannot be included in update requests.
parameters:
- in: path
name: id
required: true
schema:
type: integer
description: Agreement ID
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/AgreementData"
- $ref: "#/components/schemas/ContractAgreementData"
- $ref: "#/components/schemas/GrantAgreementData"
- $ref: "#/components/schemas/DirectAgreementData"
- $ref: "#/components/schemas/IaaAgreementData"
- $ref: "#/components/schemas/AaAgreementData"
responses:
"200":
description: Agreement updated successfully
content:
application/json:
schema:
type: object
required:
- message
- id
properties:
message:
type: string
example: "Agreement updated"
id:
type: integer
description: ID of the updated agreement
"400":
description: |
Bad Request - This error will be returned when:
- The request contains invalid data
- The request attempts to modify immutable fields on an awarded agreement (fields listed in _meta.immutable_awarded_fields cannot be changed once the agreement is awarded)
- The request includes budget_line_items or services_components (these cannot be updated via this endpoint)
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: "Cannot update immutable field 'contract_type' on awarded agreement"
errors:
type: object
additionalProperties:
type: array
items:
type: string
"404":
description: Not Found
"500":
description: Internal Server Error
patch:
tags:
- Agreements
operationId: Update Agreement (Partial)
description: |
Partially update an existing agreement. Only provided fields are updated.
Budget line items and services components cannot be included in update requests.
parameters:
- in: path
name: id
required: true
schema:
type: integer
description: Agreement ID
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/AgreementData"
- $ref: "#/components/schemas/ContractAgreementData"
- $ref: "#/components/schemas/GrantAgreementData"
- $ref: "#/components/schemas/DirectAgreementData"
- $ref: "#/components/schemas/IaaAgreementData"
- $ref: "#/components/schemas/AaAgreementData"
responses:
"200":
description: Agreement updated successfully
content:
application/json:
schema:
type: object
required:
- message
- id
properties:
message:
type: string
example: "Agreement updated"
id:
type: integer
description: ID of the updated agreement
"400":
description: |
Bad Request - This error will be returned when:
- The request contains invalid data
- The request attempts to modify immutable fields on an awarded agreement (fields listed in _meta.immutable_awarded_fields cannot be changed once the agreement is awarded)
- The request includes budget_line_items or services_components (these cannot be updated via this endpoint)
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: "Cannot update immutable field 'contract_type' on awarded agreement"
errors:
type: object
additionalProperties:
type: array
items:
type: string
"404":
description: Not Found
"500":
description: Internal Server Error
delete:
tags:
- Agreements
operationId: Delete Agreement
description: Delete an existing agreement
parameters:
- in: path
name: id
required: true
schema:
type: integer
description: Agreement ID
responses:
"200":
description: Agreement deleted successfully
content:
application/json:
schema:
type: object
required:
- message
- id
properties:
message:
type: string
example: "Agreement deleted"
id:
type: integer
description: ID of the deleted agreement
"400":
description: Bad Request - Validation error prevents deletion
"404":
description: Not Found
"500":
description: Internal Server Error
/agreement-agencies/:
get:
tags:
- Agreements
operationId: getAllAgreementAgencies
summary: >
Get a list of all the Agreement Agencies. If both Requesting and Servicing are either True or False,
all agencies are returned.
parameters:
- in: query
name: requesting
description: Whether to include Requesting agencies in the return
schema:
type: boolean
- in: query
name: servicing
description: Whether to include Servicing agencies in the return
schema:
type: boolean
- $ref: "#/components/parameters/simulatedError"
description: Get Agreement Agencies
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/AgreementAgency"
/agreement-agencies/{agency_id}:
get:
tags:
- Agreements
operationId: getAgreementAgencyById
summary: Get an individual Agreement Agency
description: Get Agreement Agency by Id
parameters:
- $ref: "#/components/parameters/simulatedError"
- in: path
name: agency_id
description: Agreement Agency Id
required: true
schema:
type: integer
format: int32
minimum: 0
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/AgreementAgency"
"404":
description: The specified Agreement Agency was not found.
/agreements/{id}/history/:
get:
tags:
- Agreements
operationId: getAgreementHistoryById
description: Get Agreement History By Agreement Id
parameters:
- in: path
name: id
description: Agreement Id
required: true
schema:
type: integer
format: int32
minimum: 0
default: 1
- name: limit
in: query
schema:
type: integer
default: 10
example: 10
- name: offset
in: query
schema:
type: integer
default: 0
example: 0
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/AgreementHistory"
"404":
description: Not Found
/agreements-filters/:
get:
tags:
- Agreements
operationId: getAgreementsFilterOptions
summary: Get filter options for agreements
description: |
Returns available filter options from all agreements in the database.
This endpoint provides distinct values for filtering agreements, including
fiscal years, portfolios, project titles, agreement types, agreement names,
contract numbers, and research types.
The endpoint supports the `only_my` parameter to limit results to agreements
associated with the current user (as team member, project officer, portfolio leader, etc.).
parameters:
- in: query
name: only_my
description: |
When true, only returns filter options from agreements associated with the current user.
User association includes: team member, project officer, portfolio team leader,
division director, or users with BUDGET_TEAM/SYSTEM_OWNER roles.
schema:
type: boolean
default: false
style: form
responses:
"200":
description: Successfully retrieved agreement filter options
content:
application/json:
schema:
type: object
required:
- fiscal_years
- portfolios
- project_titles
- agreement_types
- agreement_names
- contract_numbers
- research_types
properties:
fiscal_years:
type: array
items:
type: integer
description: List of fiscal years from budget line items (sorted descending)
example: [2025, 2024, 2023]
portfolios:
type: array
items:
type: object
required:
- id
- name
properties:
id:
type: integer
name:
type: string
description: List of portfolios (sorted by name)
example:
- id: 1
name: "Child Care"
- id: 2
name: "Child Welfare"
project_titles:
type: array
items:
type: object
required:
- id
- name
properties:
id:
type: integer
name:
type: string
description: List of project titles (sorted by name)
example:
- id: 100
name: "Project Alpha"
- id: 101
name: "Project Beta"
agreement_types:
type: array
items:
type: string
enum: [CONTRACT, GRANT, IAA, AA, DIRECT_OBLIGATION]
description: List of agreement types (sorted alphabetically)
example: ["AA", "CONTRACT", "GRANT"]
agreement_names:
type: array
items:
type: object
required:
- id
- name
properties:
id:
type: integer
name:
type: string
description: List of agreement names (sorted by name)
example:
- id: 1
name: "Agreement 001"
- id: 2
name: "Agreement 002"
contract_numbers:
type: array
items:
type: string
description: List of contract numbers (only from CONTRACT and AA agreements, sorted alphabetically)
example: ["12345", "67890"]
research_types:
type: array
items:
type: object
required:
- id
- name
properties:
id:
type: integer
name:
type: string
description: List of research methodologies (currently returns empty array - business logic TBD)
example: []
"400":
description: Bad Request
"401":
description: Unauthorized - authentication required
"500":
description: Internal Server Error
/procurement-actions/:
get:
tags:
- Procurement Actions
operationId: Get Procurement Actions
summary: Get a list of procurement actions
description: Get a paginated list of procurement actions with optional filtering
parameters:
- in: query
name: agreement_id
description: Filter by agreement ID(s)
schema:
type: array
items:
type: integer
style: form
explode: true
- in: query
name: budget_line_item_id
description: Filter by budget line item ID(s)
schema:
type: array
items:
type: integer
style: form
explode: true
- in: query
name: status
description: Filter by procurement action status
schema:
type: array
items:
$ref: "#/components/schemas/ProcurementActionStatus"
style: form
explode: true
- in: query
name: award_type
description: Filter by award type
schema:
type: array
items:
$ref: "#/components/schemas/AwardType"
style: form
explode: true
- in: query
name: procurement_shop_id
description: Filter by procurement shop ID(s)
schema:
type: array
items:
type: integer
style: form
explode: true
- in: query
name: limit
description: Maximum number of procurement actions to return
schema:
type: integer
default: 10
max: 50
style: form
- in: query
name: offset
description: Number of procurement actions to skip before returning results
schema:
type: integer
default: 0
style: form
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: "#/components/schemas/ProcurementActionResponse"
count:
type: integer
description: Total number of procurement actions matching the query
limit:
type: integer
description: Maximum number of procurement actions returned
offset:
type: integer
description: Number of procurement actions skipped
required:
- data
- count
- limit
- offset
"400":
description: Bad Request
"500":
description: Internal Server Error
/procurement-actions/{procurement_action_id}:
get:
tags:
- Procurement Actions
operationId: Get Procurement Action
summary: Get a procurement action by ID
description: Get a specific procurement action by ID
parameters:
- in: path
name: procurement_action_id
required: true
schema:
type: integer
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ProcurementActionResponse"
examples:
"0":
$ref: "#/components/examples/ProcurementActionInProcess"
"1":
$ref: "#/components/examples/ProcurementActionAwarded"
"404":
description: Not Found
"500":
description: Internal Server Error
/procurement-trackers/:
get:
tags:
- Procurement Trackers
operationId: Get Procurement Trackers
summary: Get a list of procurement trackers
description: Get a paginated list of procurement trackers with optional filtering
parameters:
- in: query
name: agreement_id
description: Filter by agreement ID(s)
schema:
type: array
items:
type: integer
style: form
explode: true
- in: query
name: limit
description: Maximum number of procurement trackers to return
schema:
type: integer
default: 10
minimum: 1
maximum: 50
style: form
- in: query
name: offset
description: Number of procurement trackers to skip before returning results
schema:
type: integer
default: 0
minimum: 0
style: form
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: "#/components/schemas/ProcurementTrackerResponse"
count:
type: integer
description: Total number of procurement trackers matching the query
limit:
type: integer
description: Maximum number of procurement trackers returned
offset:
type: integer
description: Number of procurement trackers skipped
required:
- data
- count
- limit
- offset
examples:
"0":
$ref: "#/components/examples/ProcurementTrackersList"
"400":
description: Bad Request
"500":
description: Internal Server Error
/procurement-trackers/{id}:
get:
tags:
- Procurement Trackers
operationId: Get Procurement Tracker
summary: Get a procurement tracker by ID
description: Get a specific procurement tracker by ID with its associated steps
parameters:
- in: path
name: id
required: true
schema:
type: integer
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ProcurementTrackerResponse"
examples:
InProgress:
$ref: "#/components/examples/ProcurementTracker"
NewlyInitialized:
$ref: "#/components/examples/ProcurementTrackerNewlyInitialized"
"404":
description: Not Found
"500":
description: Internal Server Error
/procurement-tracker-steps/:
get:
tags:
- Procurement Tracker Steps
operationId: Get Procurement Tracker Steps
summary: Get a list of procurement tracker steps
description: >-
Get a paginated list of procurement tracker steps with optional
filtering by agreement ID
parameters:
- in: query
name: agreement_id
description: Filter by agreement ID
schema:
type: integer
style: form
- in: query
name: limit
description: Maximum number of procurement tracker steps to return
schema:
type: integer
default: 10
minimum: 1
maximum: 50
style: form
- in: query
name: offset
description: Number of procurement tracker steps to skip before returning results