{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/indian-institute-of-technology-kharagpur/main/json-schema/indian-institute-of-technology-kharagpur-erp-cep-request-schema.json",
  "title": "IIT Kharagpur ERP CEP Brochure Request",
  "description": "JSON Schema for the single query parameter of the IIT Kharagpur ERP Continuing Education Programme brochure endpoint, and for the two-outcome response envelope a client must model. The response body is a PDF or nothing, so the schema describes the discriminator rather than the document. Derived from live probes of eight course_id values on 2026-09-01. IIT Kharagpur publishes no schema for this endpoint.",
  "x-provenance": {
    "generated": "2026-09-01",
    "method": "derived",
    "source": "https://erp.iitkgp.ac.in/InfoCellDetails/resources/external/cepdata",
    "status": 200,
    "x-operator": "institution"
  },
  "type": "object",
  "required": ["course_id"],
  "properties": {
    "course_id": {
      "type": "string",
      "description": "Structured institutional course identifier. Two shapes observed. Slashes are sent unencoded by the institute's own links.",
      "anyOf": [
        {
          "pattern": "^IIT/CEP/[A-Z]{3}/[A-Z]{3}/[0-9]{4}-[0-9]{4}/[A-Z]{2}/[0-9]+$",
          "description": "Long form: IIT/CEP/<programme>/<programme>/<academic year>/<department code>/<serial>.",
          "examples": ["IIT/CEP/CFC/CFC/2025-2026/HS/144", "IIT/CEP/CON/CON/2025-2026/BT/100"]
        },
        {
          "pattern": "^CEP/[A-Z]{3}/[0-9]{2}-[0-9]{2}/[A-Z]{2}/[0-9]+$",
          "description": "Short form: CEP/<type>/<yy-yy>/<department code>/<serial>.",
          "examples": ["CEP/WRK/25-26/CD/2325", "CEP/CSC/25-26/AE/2323"]
        }
      ]
    }
  },
  "$defs": {
    "ResponseOutcome": {
      "description": "The endpoint answers 200 in both cases. Content-Type is the only discriminator; there is no 404 and no error document.",
      "oneOf": [
        {
          "title": "Brochure returned",
          "type": "object",
          "properties": {
            "status": { "const": 200 },
            "contentType": { "const": "application/pdf" },
            "body": { "type": "string", "contentMediaType": "application/pdf", "contentEncoding": "base64" }
          }
        },
        {
          "title": "No brochure for this course",
          "type": "object",
          "description": "Also the response to an unknown course_id and to a request with no course_id at all.",
          "properties": {
            "status": { "const": 200 },
            "contentType": { "const": "text/plain; charset=UTF-8" },
            "body": { "const": "" }
          }
        }
      ]
    }
  }
}
