{"swagger":"2.0","security":[{"basicAuth":[]}],"servers":[{"description":"SwaggerHub API Auto Mocking","url":"https://virtserver.swaggerhub.com/servizist/aapass-ticketing-api/1"},{"description":"SwaggerHub API Auto Mocking","url":"https://ticketing.servizist.it:8443/api/aapass/purchases/v1"}],"info":{"description":"This is a simple API","version":"1","title":"AAPASS ticketing API","contact":{"email":"developer@servizist.it"}},"tags":[{"name":"auth","description":"Authentication related requests"},{"name":"purchase","description":"Purchase related requests"}],"paths":{"/login":{"post":{"tags":["auth"],"summary":"Generates an auth token for subsequent requests","operationId":"createAuthToken","description":"The given `ticket_number` is checked for validity (if it is known, is valid and can be used to purchase travels).\n\nIf valid a OTP is generated and send to the customers mobile phone number (if present), the same OTP with a token is returned to the caller. \n\nThe token must be used for all subsequent calls.\n","responses":{"201":{"description":"Auth token successfully created","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"$ref":"#/components/schemas/Token"},"otp":{"$ref":"#/components/schemas/OTP"}}}}}},"404":{"description":"The provided ticket number is invalid or unknown"},"406":{"description":"It is not possibile to perform a login with the given ticket number"},"500":{"description":"Internal server errror"},"504":{"description":"Backend services unreachable"}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TicketNumber"}}}}}},"/otp/verify":{"post":{"tags":["auth"],"summary":"Verifies if the given `otp` is valid for the given `token`","operationId":"verifyOTP","description":"This methods checks if the given `otp` is valid for the given `otp`. \n\nAn OTP is only valid for a max. of 5 minutes after it has been issued\n","responses":{"204":{"description":"OTP is valid"},"404":{"description":"Invalid token"},"406":{"description":"Invalid OTP"},"500":{"description":"Internal server errror"},"504":{"description":"Backend services unreachable"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"$ref":"#/components/schemas/Token"},"otp":{"$ref":"#/components/schemas/OTP"}}}}}}}},"/travel":{"post":{"tags":["purchases"],"summary":"\"Purchases\" a requested travel","operationId":"purchaseTravel","description":"This methods \\\"purchases\\\" the given travel for the contract associated to the given `token`.\nBefore accepting the travel, checks are performed to assure that the contract is still valid and neither the contract nor the the currently valid ticket is blocked and that the customer has a positive balance.\nThe information provided for the travel are also checked for consistency and validity (eg. platforms, carriers, mot ... must be known)\n","responses":{"201":{"description":"The requested travel has been created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TravelID"}}}},"404":{"description":"Invalid token"},"403":{"description":"Purchase of travel not permitted for the referenced contract/ticket"},"406":{"description":"The information provided for the travel are not acceptable"},"409":{"description":"There is already a purchased travel present for the referenced contract"}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Travel"}}}}}},"/travel/{travel_id}":{"delete":{"tags":["purchases"],"summary":"Deletes an already purchased travel","parameters":[{"name":"travel_id","in":"path","description":"The identifier of the travel to be deleted","required":true,"schema":{"$ref":"#/components/schemas/TravelID"}}],"operationId":"deleteTravel","description":"The purchased travel identified by the given `travel_id` is deleted.\n","responses":{"204":{"description":"The travel has been deleted"},"404":{"description":"No travel with the given identifier"},"403":{"description":"Deletion not permitted, travel already started."},"406":{"description":"Invalid token"}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Token"}}}}}}},"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic"}},"schemas":{"TicketNumber":{"type":"string","description":"The 12 digit ticket number of a AltoAdige Pass","maxLength":12,"minLength":12,"pattern":"^\\d{12}$","example":"800012345600"},"Token":{"type":"string","description":"Access token returned by the login function and to be used with all other requets","example":"a4ZLM7nQ0EKISKOEmiYwK6SCe20AA8gs"},"OTP":{"type":"string","description":"The one time password send to the customer by SMS for verification","maxLength":6,"minLength":6,"pattern":"^\\d{6}$","example":123456},"TravelID":{"type":"string","description":"A unique identifier of a travel","example":"4L9uUxRmIrUjXTFYqCSlVUBQ3KMrtqDKBx"},"Travel":{"type":"object","properties":{"legs":{"type":"array","items":{"$ref":"#/components/schemas/Leg"}},"bike":{"type":"boolean"},"animal":{"type":"boolean"}},"description":"A travel"},"Leg":{"type":"object","properties":{"departure":{"$ref":"#/components/schemas/Point"},"destination":{"$ref":"#/components/schemas/Point"},"mot":{"$ref":"#/components/schemas/Mot"}}},"Point":{"type":"object","properties":{"platform":{"type":"integer","example":1},"time":{"type":"string","format":"date-time","example":"2021-11-01 13:50:00"},"name":{"type":"string","example":"Busbahnhof Bozen"}}},"Mot":{"type":"object","properties":{"type":{"type":"integer"},"operator":{"type":"string","example":"SASA"},"productId":{"type":"integer"}}}}}}