Skip to content
Snippets Groups Projects
workday-funding.json 11.8 KiB
Newer Older
{
    "openapi": "3.0.2",
    "info": {
        "title": "funding",
        "version": "1.0.0",
        "contact": {
            "name": "DoIT ASP Integration API Team",
            "email": "asp-integrations-api-team@g-groups.wisc.edu"
        },
        "description": "A implementation of the Funding API. It is used to verify the funding used in Workday."
    },
    "servers": [
        {
            "url": "https://mock.dev.api.wisc.edu"
        }
    ],
    "paths": {
        "/funding/validate-funding": {
            "post": {
                "description": "Send in WorkDay funding and get back if it is valid.",
                "tags": [
                    "WorkDay Funding"
                ],
                "requestBody": {
                    "$ref": "#/components/requestBodies/journal"
                },
                "responses": {
                    "200": {
                        "description": "OK.  Validation completed successfully.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/results"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "errors": {
                                            "type": "array"
                                        },
                                        "items": {
                                            "$ref": "#/components/schemas/errors"
                                        }
                                    }
                                },
                                "examples": {
                                    "application/json": {
                                        "value": {
                                            "errors": [
                                                {
                                                    "status": 400,
                                                    "title": "Bad Request",
                                                    "detail": "You supplied data that could not be processed. See response body for more detail."
                                                }
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "Service Unavailable.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "errors": {
                                            "type": "array"
                                        },
                                        "items": {
                                            "$ref": "#/components/schemas/errors"
                                        }
                                    }
                                },
                                "examples": {
                                    "application/json": {
                                        "value": {
                                            "errors": [
                                                {
                                                    "status": 503,
                                                    "title": "Service Unavailable",
                                                    "detail": "The Workday server did not respond.  Try again later."
                                                }
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "requestBodies": {
            "journal": {
                "description": "A journal request body.",
                "required": true,
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "data": {
                                    "type": "object",
                                    "required": [
                                        "type",
                                        "attributes"
                                    ],
                                    "properties": {
                                        "lid": {
                                            "type": "string",
                                            "example": "1"
                                        },
                                        "type": {
                                            "type": "string",
                                            "example": "journals"
                                        },
                                        "attributes": {
                                            "$ref": "#/components/schemas/fundingAttributes"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "schemas": {
            "fundingAttributes": {
                "type": "object",
                "required": [
                    "company"
                ],
                "properties": {
                    "company": {
                        "description": "",
                        "type": "string",
                        "minLength": 5,
                        "maxLength": 5,
                        "example": "UWMSN"
                    },
                    "accountingDate": {
                        "type": "string",
                        "example": "2023-02-17",
                        "format": "date"
                    },
                    "ledger": {
                        "type": "string",
                        "example": "ACTUALS",
                        "default": "ACTUALS"
                    },
                    "lines": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "required": [
                                "costCenter"
                            ],
                            "properties": {
                                "costCenter": {
                                    "type": "string",
                                    "example": "CC000127"
                                },
                                "fund": {
                                    "type": "string",
                                    "example": "FD0102"
                                },
                                "functionId": {
                                    "type": "string",
                                    "example": "FN0500"
                                },
                                "ledgerAccount": {
                                    "type": "string",
                                    "example": "6015"
                                },
                                "projectType": {
                                    "type": "string",
                                    "enum": [
                                        "GIFT",
                                        "GRANT",
                                        "NONE",
                                        "PROJECT"
                                    ]
                                },
                                "project": {
                                    "type": "string",
                                    "example": "20493043"
                                },
                                "program": {
                                    "type": "string",
                                    "example": "PG000005076"
                                },
                                "spendCategory": {
                                    "type": "string",
                                    "example": "SC00244"
                                }
                            }
                        }
                    }
                }
            },
            "results": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "lid": {
                                "type": "string",
                                "example": "1"
                            },
                            "type": {
                                "type": "string",
                                "example": "journals"
                            },
                            "attributes": {
                                "type": "object",
                                "properties": {
                                    "valid": {
                                        "type": "boolean"
                                    },
                                    "journalErrors": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "lines": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "valid": {
                                                    "type": "boolean"
                                                },
                                                "errors": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "errors": {
                "type": "object",
                "properties": {
                    "errors": {
                        "type": "array",
                        "items": {
                            "description": "An error",
                            "properties": {
                                "status": {
                                    "type": "string"
                                },
                                "title": {
                                    "type": "string"
                                },
                                "detail": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}