| 1 | openapi: 3.0.1
|
|---|
| 2 | info:
|
|---|
| 3 | title: External Web Request API
|
|---|
| 4 | description: This endpoint allows clients to post an external web request containing items with dataProviderId, accessionNumber, or both. The endpoint validates the request, checks for missing or unavailable items, creates the external request, and returns its id.
|
|---|
| 5 | version: 1.0.0
|
|---|
| 6 | servers:
|
|---|
| 7 | - url: https://ars-grin.gov/gringlobal/api
|
|---|
| 8 | paths:
|
|---|
| 9 | /external-request:
|
|---|
| 10 | post:
|
|---|
| 11 | summary: Submit an external web request
|
|---|
| 12 | description: This endpoint allows clients to post an external web request containing items with dataProviderId, accessionNumber, or both. The endpoint validates the request, checks for missing or unavailable items, creates the external request, and returns its id.
|
|---|
| 13 | parameters:
|
|---|
| 14 | - name: authKey
|
|---|
| 15 | in: query
|
|---|
| 16 | required: true
|
|---|
| 17 | schema:
|
|---|
| 18 | type: string
|
|---|
| 19 | description: Authorization key for the request
|
|---|
| 20 | requestBody:
|
|---|
| 21 | required: true
|
|---|
| 22 | content:
|
|---|
| 23 | application/json:
|
|---|
| 24 | schema:
|
|---|
| 25 | $ref: '#/components/schemas/ExternalWebRequestModel'
|
|---|
| 26 | responses:
|
|---|
| 27 | '201':
|
|---|
| 28 | description: Successfully created external web request
|
|---|
| 29 | content:
|
|---|
| 30 | application/json:
|
|---|
| 31 | schema:
|
|---|
| 32 | type: object
|
|---|
| 33 | properties:
|
|---|
| 34 | requestId:
|
|---|
| 35 | type: string
|
|---|
| 36 | example: "4d5e6f7g-8h9i-0j1k-2l3m-4n5o6p7q8r9s"
|
|---|
| 37 | '400':
|
|---|
| 38 | description: Invalid request - schema violation. Response may contain request items found invalid as well.
|
|---|
| 39 | content:
|
|---|
| 40 | application/json:
|
|---|
| 41 | schema:
|
|---|
| 42 | $ref: '#/components/schemas/ErrorResponseInvalid'
|
|---|
| 43 | '401':
|
|---|
| 44 | description: Unauthorized - invalid auth key provided
|
|---|
| 45 | content:
|
|---|
| 46 | application/json:
|
|---|
| 47 | schema:
|
|---|
| 48 | type: object
|
|---|
| 49 | properties:
|
|---|
| 50 | message:
|
|---|
| 51 | type: string
|
|---|
| 52 | example: "Invalid authorization key."
|
|---|
| 53 | '403':
|
|---|
| 54 | description: Some requested items are unavailable
|
|---|
| 55 | content:
|
|---|
| 56 | application/json:
|
|---|
| 57 | schema:
|
|---|
| 58 | $ref: '#/components/schemas/ErrorResponseNotFoundOrNotAvailable'
|
|---|
| 59 | '404':
|
|---|
| 60 | description: Some requested items are not found
|
|---|
| 61 | content:
|
|---|
| 62 | application/json:
|
|---|
| 63 | schema:
|
|---|
| 64 | $ref: '#/components/schemas/ErrorResponseNotFoundOrNotAvailable'
|
|---|
| 65 | '500':
|
|---|
| 66 | description: Server error
|
|---|
| 67 | content:
|
|---|
| 68 | application/json:
|
|---|
| 69 | schema:
|
|---|
| 70 | type: object
|
|---|
| 71 | properties:
|
|---|
| 72 | message:
|
|---|
| 73 | type: string
|
|---|
| 74 | example: "Server Error. Unable to create external request."
|
|---|
| 75 | components:
|
|---|
| 76 | schemas:
|
|---|
| 77 | ExternalWebRequestModel:
|
|---|
| 78 | type: object
|
|---|
| 79 | required:
|
|---|
| 80 | - items
|
|---|
| 81 | properties:
|
|---|
| 82 | items:
|
|---|
| 83 | type: array
|
|---|
| 84 | items:
|
|---|
| 85 | $ref: '#/components/schemas/ExternalWebRequestItem'
|
|---|
| 86 | ExternalWebRequestItem:
|
|---|
| 87 | type: object
|
|---|
| 88 | minProperties: 1
|
|---|
| 89 | properties:
|
|---|
| 90 | accessionNumber:
|
|---|
| 91 | type: string
|
|---|
| 92 | maxLength: 25
|
|---|
| 93 | example: "PI123456"
|
|---|
| 94 | dataProviderId:
|
|---|
| 95 | type: string
|
|---|
| 96 | maxLength: 10
|
|---|
| 97 | example: "1000015"
|
|---|
| 98 | ExternalWebRequestItemResponse:
|
|---|
| 99 | type: object
|
|---|
| 100 | properties:
|
|---|
| 101 | accessionNumber:
|
|---|
| 102 | type: string
|
|---|
| 103 | maxLength: 25
|
|---|
| 104 | example: "PI123456"
|
|---|
| 105 | dataProviderId:
|
|---|
| 106 | type: string
|
|---|
| 107 | maxLength: 10
|
|---|
| 108 | example: "1000015"
|
|---|
| 109 | status:
|
|---|
| 110 | type: string
|
|---|
| 111 | enum: ["NOT_AVAILABLE", "NOT_FOUND", "NOT_PROCESSED", "AVAILABLE"]
|
|---|
| 112 | messsages:
|
|---|
| 113 | type: array
|
|---|
| 114 | items:
|
|---|
| 115 | type: string
|
|---|
| 116 | example: "This item is not available."
|
|---|
| 117 | ErrorResponseInvalid:
|
|---|
| 118 | type: object
|
|---|
| 119 | properties:
|
|---|
| 120 | message:
|
|---|
| 121 | type: string
|
|---|
| 122 | example: 'Request not completed: the request is invalid.'
|
|---|
| 123 | validationErrors:
|
|---|
| 124 | type: array
|
|---|
| 125 | description: List of validation errors against the overall request schema.
|
|---|
| 126 | items:
|
|---|
| 127 | type: string
|
|---|
| 128 | example: 'Required properties are missing from object: items.'
|
|---|
| 129 | items:
|
|---|
| 130 | type: array
|
|---|
| 131 | nullable: true
|
|---|
| 132 | description: List of original request items enhanced with response attributes.
|
|---|
| 133 | example: null
|
|---|
| 134 | items:
|
|---|
| 135 | $ref: '#/components/schemas/ExternalWebRequestItemResponse'
|
|---|
| 136 | ErrorResponseNotFoundOrNotAvailable:
|
|---|
| 137 | type: object
|
|---|
| 138 | properties:
|
|---|
| 139 | message:
|
|---|
| 140 | type: string
|
|---|
| 141 | example: 'Request not completed. 1 item is unavailable or not found.'
|
|---|
| 142 | validationErrors:
|
|---|
| 143 | type: array
|
|---|
| 144 | nullable: true
|
|---|
| 145 | example: null
|
|---|
| 146 | description: List of validation errors against the overall request schema
|
|---|
| 147 | items:
|
|---|
| 148 | type: string
|
|---|
| 149 | example: null
|
|---|
| 150 | items:
|
|---|
| 151 | type: array
|
|---|
| 152 | description: List of original request items enhanced with response attributes.
|
|---|
| 153 | items:
|
|---|
| 154 | $ref: '#/components/schemas/ExternalWebRequestItemResponse'
|
|---|