Skip to content

Instantly share code, notes, and snippets.

@renganatha10
Last active January 16, 2025 07:00
Show Gist options
  • Save renganatha10/0f8d84032355641dcce496568449cad8 to your computer and use it in GitHub Desktop.
Save renganatha10/0f8d84032355641dcce496568449cad8 to your computer and use it in GitHub Desktop.
{ "openapi": "3.0.1", "info": { "title": "Event Processing API", "description": "Yodel Event Processing API", "version": "1.0.0" }, "servers": [ { "url": "http://localhost:8108", "description": "Generated server url" } ], "paths": { "/receiveEvent": { "post": { "tags": [ "json-event-receiver-controller" ], "summary": "Process Tracking Event", "operationId": "processJsonEvent", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/JsonEvent" } } }, "required": true }, "responses": { "201": { "description": "Event processed successfully" }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/YodelResponseBody" }, "examples": { "Invalid Argument": { "summary": "throw when invalid request body passed", "description": "Invalid Argument", "value": { "status": "FAIL", "code": "400 BAD_REQUEST", "message": "INVALID_ARGUMENTS", "data": null, "fieldInformation": { "fieldList": [ { "field": "pudoLocationId", "information": [ "size must be between 5 and 8" ] } ] } } }, "Invalid Tac Code": { "summary": "throws when un supported tac code is passed", "description": "Invalid Tac Code", "value": { "status": "ERROR", "code": "BAD_REQUEST", "message": "NetDespatch Booking", "data": null, "fieldInformation": null } }, "Unknown event code": { "summary": "throws when un supported eventCode is passed", "description": "Unknown event code", "value": { "status": "ERROR", "code": "BAD_REQUEST", "message": "unknown eventCode: DA", "data": null, "fieldInformation": { "fieldList": [ { "field": "eventCode", "information": [ "DA" ] } ] } } } } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BadRequestResponseBody" } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/YodelResponseBody" }, "examples": { "Not found": { "summary": "endpoint not found", "description": "Not found", "value": { "status": "ERROR", "code": "NotFound", "message": "endpoint found", "data": null, "fieldInformation": null } } } } } }, "413": { "description": "Payload Too Large", "content": { "*/*": { "schema": { "type": "object" } } } }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/YodelResponseBody" }, "examples": { "UnexpectedError": { "summary": "unknown exception", "description": "UnexpectedError", "value": { "status": "ERROR", "code": "UnexpectedError", "message": "Something went wrong", "data": null, "fieldInformation": null } } } } } } } } }, "/process": { "post": { "tags": [ "event-receiver-controller" ], "summary": "Process Tracking Event", "operationId": "processEvent", "requestBody": { "content": { "application/xml": { "schema": { "$ref": "#/components/schemas/Event" } } }, "required": true }, "responses": { "200": { "description": "OK", "content": { "application/xml": { "schema": { "type": "string" } } } }, "400": { "description": "Bad Request", "content": { "*/*": { "schema": { "type": "object" } } } }, "403": { "description": "Forbidden", "content": { "*/*": { "schema": { "type": "object" } } } }, "404": { "description": "Not Found", "content": { "*/*": { "schema": { "type": "object" } } } }, "413": { "description": "Payload Too Large", "content": { "*/*": { "schema": { "type": "object" } } } }, "500": { "description": "Internal Server Error", "content": { "*/*": { "schema": { "type": "object" } } } } } } }, "/events/process": { "post": { "tags": [ "event-receiver-controller" ], "summary": "Process Tracking Event", "operationId": "processEvent_1", "requestBody": { "content": { "application/xml": { "schema": { "$ref": "#/components/schemas/Event" } } }, "required": true }, "responses": { "200": { "description": "OK", "content": { "application/xml": { "schema": { "type": "string" } } } }, "400": { "description": "Bad Request", "content": { "*/*": { "schema": { "type": "object" } } } }, "403": { "description": "Forbidden", "content": { "*/*": { "schema": { "type": "object" } } } }, "404": { "description": "Not Found", "content": { "*/*": { "schema": { "type": "object" } } } }, "413": { "description": "Payload Too Large", "content": { "*/*": { "schema": { "type": "object" } } } }, "500": { "description": "Internal Server Error", "content": { "*/*": { "schema": { "type": "object" } } } } } } } }, "components": { "schemas": { "BadRequestErrorField": { "type": "object", "properties": { "field": { "type": "string" }, "messageSet": { "uniqueItems": true, "type": "array", "items": { "type": "string" } } }, "description": "filedList", "example": [] }, "BadRequestResponseBody": { "type": "object", "properties": { "status": { "type": "string", "description": "response status", "example": "ERROR", "enum": [ "FAIL", "SUCCESS", "ERROR" ] }, "code": { "type": "string", "description": "response code", "example": "400" }, "message": { "type": "string", "description": "detailed message", "example": "Netdespatch booking" }, "fieldInformation": { "$ref": "#/components/schemas/BadRequestResponseFieldList" } } }, "BadRequestResponseFieldList": { "type": "object", "properties": { "fieldList": { "type": "array", "description": "filedList", "example": [], "items": { "$ref": "#/components/schemas/BadRequestErrorField" } } } }, "YodelResponseBody": { "type": "object", "properties": { "status": { "type": "string", "enum": [ "FAIL", "SUCCESS", "ERROR" ] }, "code": { "type": "string" }, "message": { "type": "string" }, "data": { "type": "object" }, "fieldInformation": { "$ref": "#/components/schemas/YodelResponseFieldList" } } }, "YodelResponseFieldList": { "type": "object", "properties": { "fieldList": { "type": "array", "items": { "$ref": "#/components/schemas/YodelRestErrorField" } } } }, "YodelRestErrorField": { "type": "object", "properties": { "field": { "type": "string" }, "information": { "uniqueItems": true, "type": "array", "items": { "type": "string" } } } }, "JsonEvent": { "required": [ "eventCode", "eventDateTime", "parcelUpi", "pudoLocationId" ], "type": "object", "properties": { "parcelUpi": { "maxLength": 19, "minLength": 16, "type": "string", "description": "parcelUpi of the event", "example": "8KH413865900A002" }, "eventDateTime": { "type": "string", "description": "event occurrence date", "format": "date-time", "example": "2024-11-13T14:45:44Z" }, "eventCode": { "maxLength": 2, "minLength": 2, "type": "string", "description": "eventCode", "example": "ZC" }, "pudoLocationId": { "maxLength": 8, "minLength": 5, "type": "string", "description": "pudoLocationId", "example": "62637" } } }, "Event": { "type": "object", "properties": { "requestHeaders": { "type": "object", "additionalProperties": { "type": "string" } }, "requestBody": { "type": "string" }, "processingState": { "type": "object", "additionalProperties": { "type": "object" } } } } } } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment