tdevapigists
1/25/2017 - 1:28 AM

Submit Transition Order Swagger.js

{
    "swagger": "2.0",
    "info": {
        "title": "Submit Transition Order Service",
        "description": "Submit Transition Order Service is used to submit a cloudSense basket for the transition of voice/ADSL services.",
        "version": "1.0.0",
        "termsOfService": "https://dev.telstra.com/legal"
    },
    "host": "api.in.telstra.com.au",
    "basePath": "/application/nbn-transitions/v1/transition-orders",
    "schemes": [
        "https"
    ],
    "paths": {
        "/": {
            "post": {
                "operationId": "submit-transition-order",
                "summary": "Submit a cloudSense basket for the transition of voice/ADSL services.\n",
                "description": "Submit a cloudSense basket for the transition of voice/ADSL services.\n",
                "produces": [
                    "application/json"
                ],
                "consumes": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "name": "Authorization",
                        "in": "header",
                        "description": "A header in the format 'Bearer {access_token}' - get the token by using the OAuth API with the scope TRANSITIONORDERS",
                        "type": "string",
                        "required": true
                    },
                    {
                        "name": "Content-Type",
                        "in": "header",
                        "description": "Should be 'application/json'",
                        "type": "string",
                        "required": true
                    },
                    {
                        "name": "payload",
                        "in": "body",
                        "description": "A JSON payload containing cartId and customerOrderReference",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/SubmitTransitionOrderRequest"
                        }
                    }
                ],
                "tags": [
                    "submit-transition-order"
                ],
                "responses": {
                    "200": {
                        "description": "Success - Transition Order submitted successfully",
                        "schema": {
                            "$ref": "#/definitions/SubmitTransitionOrderResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request - Data Errors from downstream due to bad input in the request",
                        "schema": {
                            "$ref": "#/definitions/400Error"
                        }
                    },
                    "401": {
                        "description": "The request requires user authentication. The response MUST include a WWW-Authenticate header field containing a challenge applicable to the requested resource",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    },
                    "404": {
                        "description": "Not Found - Basket Not Found",
                        "schema": {
                            "$ref": "#/definitions/404Error"
                        }
                    },
                    "422": {
                        "description": "Input Validation Error - Unexpected input parameter or Mandatory input parameter missing or Invalid input parameter value or Incorrect type. Expected string.",
                        "schema": {
                            "$ref": "#/definitions/422Error"
                        }
                    },
                    "429": {
                        "description": "The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    },
                    "500": {
                        "description": "Internal server error",
                        "schema": {
                            "$ref": "#/definitions/500Error"
                        }
                    },
                    "502": {
                        "description": "Error returned from downstream",
                        "schema": {
                            "$ref": "#/definitions/downstreamError"
                        }
                    },
                    "503": {
                        "description": "Downstream service is down",
                        "schema": {
                            "$ref": "#/definitions/downstreamError"
                        }
                    },
					"520": {
                        "description": "Unknown Error",
                        "schema": {
                            "$ref": "#/definitions/unknownError"
                        }
                    }
                },
                "security": [
                    {
                        "OAuth2": [
                            "TRANSITIONORDERS"
                        ]
                    }
                ]
            }
        }
    },
    "securityDefinitions": {
        "OAuth2": {
            "type": "oauth2",
            "tokenUrl": "/v1/oauth/token",
            "flow": "application",
            "scopes": {
                "TRANSITIONORDERS": "Use for Submit Transition Order API"
            }
        }
    },
    "definitions": {
        "SubmitTransitionOrderRequest": {
            "type": "object",
            "properties": {
				"data" : {
					"type": "object",
					"properties": {
						"customerOrderReference": {
							"type": "string",
							"description": "customerOrderReference to uniquely identify his transition order"
						},
						"cartId": {
							"type": "string",
							"description": "cart created for a customer to transtion to NBN"
						}
					},
					"required": [
						"customerOrderReference",
						"cartId"
					]
				}
            },
            "required": [
                "data"
            ],
            "example": {
				"data": {
					"cartId": "6c4511d6-5e3a-4941-9b24-87d6bcb3342f",
					"customerOrderReference": "000000000682"
				}
            }
        },
        "SubmitTransitionOrderResponse": {
            "type": "object",
            "properties": {
                "status": {
                    "type": "integer",
                    "format": "int32",
                    "description": "Success Http Status Code"
                },
                "time": {
                    "type": "string",
					"description": "Timestamp"
                },
                "data": {
                    "type": "object",
                    "properties": {
                        "customerOrderReference": {
                            "type": "string",
                            "description": "customerOrderReference to uniquely identify his transition order"
                        },
                        "orderStatus": {
                            "type": "string",
                            "description": "Transition Order Status"
                        }
                    },
                    "required": [
                        "customerOrderReference",
                        "orderStatus"
                    ],
					"description" : "Response Data"
                },
                "correlationId": {
                    "type": "string",
					"description": "correlationId"
                }
            },
            "required": [
                "time",
                "data",
                "correlationId"
            ],
            "example": {
                "status": 200,
                "time": "2016-07-25T20:42:18+10:00",
                "data": {
                    "customerOrderReference": "000000000682",
                    "orderStatus": "Accepted"
                },
                "correlationId": "43fc76cb-cb5b-400b-9064-cbd9d87200d6"
            }
        },
		"Error": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "integer",
					"description": "Error Code"
                },
                "status": {
                    "type": "integer",
                    "format": "int32",
                    "description": "Error Status Code"
                },
                "time": {
                    "type": "string",
					"description": "Timestamp"
                },
                "errors": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "integer",
								"description": "Error Code"
                            },
                            "message": {
                                "type": "string",
								"description": "Error message"
                            }
                        },
                        "required": [
                            "code",
                            "message"
                        ]
                    },
					"description": "Array of Errors"
                },
                "correlationId": {
                    "type": "string",
					"description": "correlationId"
                },
                "message": {
                    "type": "string",
					"description": "Error message"
                }
            },
            "required": [
                "time",
                "correlationId",
                "message"
            ],
			"example" : {
				"code": 1012,
				"status": 401,
				"time": "2017-01-13T13:24:51+05:30",
				"errors": [
					{  
						"code": 1012,
						"message": "Authorization Failure"
					}
				],
				"correlationId": "60f6c539-d344-4592-8675-409fc9ba0840",    
				"message": "Authorization Failure"
			}
        },
        "400Error": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "integer",
					"description": "Bad Request Error Code"
                },
                "status": {
                    "type": "integer",
                    "format": "int32",
                    "description": "Bad Request Error Status Code"
                },
                "time": {
                    "type": "string",
					"description": "Timestamp"
                },
                "errors": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "integer",
								"description": "Bad Request Error Code"
                            },
                            "message": {
                                "type": "string",
								"description": "Bad Request Error message"
                            }
                        },
                        "required": [
                            "code",
                            "message"
                        ]
                    },
					"description": "Array of Bad Request error details"
                },
                "correlationId": {
                    "type": "string",
					"description": "correlationId"
                },
                "message": {
                    "type": "string",
					"description": "Bad Request Error message"
                }
            },
            "required": [
                "time",
                "correlationId",
                "message"
            ],
			"example" : {
				"code": 1011,
				"status": 400,
				"time": "2017-01-13T13:24:51+05:30",
				"errors": [
					{  
						"code": 1011,
						"message": "Order-Generation: Basket is empty"
					}
				],
				"correlationId": "60f6c539-d344-4592-8675-409fc9ba0840",    
				"message": "Order-Generation: Basket is empty"
			}
        },
		"404Error": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "integer",
					"description": "Not Found Error Code"
                },
                "status": {
                    "type": "integer",
                    "format": "int32",
                    "description": "Not Found Error Status Code"
                },
                "time": {
                    "type": "string",
					"description": "Timestamp"
                },
                "errors": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "integer",
								"description": "Not Found Error Code"
                            },
                            "message": {
                                "type": "string",
								"description": "Not Found Error message"
                            }
                        },
                        "required": [
                            "code",
                            "message"
                        ]
                    },
					"description": "Array of Not Found error details"
                },
                "correlationId": {
                    "type": "string",
					"description": "correlationId"
                },
                "message": {
                    "type": "string",
					"description": "Not Found Error message"
                }
            },
            "required": [
                "time",
                "correlationId",
                "message"
            ],
			"example" : {
				"code": 1010,
				"status": 404,
				"time": "2017-01-13T13:24:51+05:30",
				"errors": [
					{  
						"code": 1010,
						"message": "Basket Not found"
					}
				],
				"correlationId": "60f6c539-d344-4592-8675-409fc9ba0840",    
				"message": "Basket Not found"
			}
        },
		"422Error": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "integer",
					"description": "Input Validation Error Code"
                },
                "status": {
                    "type": "integer",
                    "format": "int32",
                    "description": "Input Validation Error Status Code"
                },
                "time": {
                    "type": "string",
					"description": "Timestamp"
                },
                "errors": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "integer",
								"description": "Input Validation Error Code"
                            },
                            "message": {
                                "type": "string",
								"description": "Input Validation Error message"
                            },
							"field": {
                                "type": "string",
								"description": "Input Validation Error field"
                            }
                        },
                        "required": [
                            "code",
                            "message",
							"field"
                        ]
                    },
					"description": "Array of Input Validation error details"
                },
                "correlationId": {
                    "type": "string",
					"description": "correlationId"
                },
                "message": {
                    "type": "string",
					"description": "Input Validation Error message"
                }
            },
            "required": [
                "time",
                "correlationId",
                "message"
            ],
			"example" : {
				"code": 1001,
				"status": 422,
				"time": "2017-01-13T13:24:51+05:30",
				"errors": [
					{  
						"code": 1001,
						"message": "Mandatory input parameter missing",
						"field" : "cartId"
					}
				],
				"correlationId": "60f6c539-d344-4592-8675-409fc9ba0840",    
				"message": "Mandatory input parameter missing"
			}
        },
		"500Error": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "integer",
					"description": "Internal Server Error Code"
                },
                "status": {
                    "type": "integer",
                    "format": "int32",
                    "description": "Internal Server Error Status Code"
                },
                "time": {
                    "type": "string",
					"description": "Timestamp"
                },
                "errors": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "integer",
								"description": "Internal Server Error Code"
                            },
                            "message": {
                                "type": "string",
								"description": "Internal Server Error message"
                            }
                        },
                        "required": [
                            "code",
                            "message"
                        ]
                    },
					"description": "Array of Internal Server error details"
                },
                "correlationId": {
                    "type": "string",
					"description": "correlationId"
                },
                "message": {
                    "type": "string",
					"description": "Internal Server Error message"
                }
            },
            "required": [
                "time",
                "correlationId",
                "message"
            ],
			"example" : {
				"code": 1007,
				"status": 500,
				"time": "2017-01-13T13:24:51+05:30",
				"errors": [
					{  
						"code": 1007,
						"message": "Internal Server Error"
					}
				],
				"correlationId": "60f6c539-d344-4592-8675-409fc9ba0840",    
				"message": "Internal Server Error"
			}
        },
		"downstreamError": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "integer",
					"description": "Downstream Error Code"
                },
                "status": {
                    "type": "integer",
                    "format": "int32",
                    "description": "Downstream Error Status Code"
                },
                "time": {
                    "type": "string",
					"description": "Timestamp"
                },
                "errors": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "integer",
								"description": "Downstream Error Code"
                            },
                            "message": {
                                "type": "string",
								"description": "Downstream Error message"
                            }
                        },
                        "required": [
                            "code",
                            "message"
                        ]
                    },
					"description": "Array of Downstream error details"
                },
                "correlationId": {
                    "type": "string",
					"description": "correlationId"
                },
                "message": {
                    "type": "string",
					"description": "Downstream Error message"
                }
            },
            "required": [
                "time",
                "correlationId",
                "message"
            ],
			"example" : {
				"code": 1008,
				"status": 502,
				"time": "2017-01-13T13:24:51+05:30",
				"errors": [
					{  
						"code": 1008,
						"message": "Error returned from downstream"
					}
				],
				"correlationId": "60f6c539-d344-4592-8675-409fc9ba0840",    
				"message": "Error returned from downstream"
			}
        },
		"unknownError": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "integer",
					"description": "Unknown Error Code"
                },
                "status": {
                    "type": "integer",
                    "format": "int32",
                    "description": "Unknown Error Status Code"
                },
                "time": {
                    "type": "string",
					"description": "Timestamp"
                },
                "errors": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "integer",
								"description": "Unknown Error Code"
                            },
                            "message": {
                                "type": "string",
								"description": "Unknown Error message"
                            }
                        },
                        "required": [
                            "code",
                            "message"
                        ]
                    },
					"description": "Array of Unknown error details"
                },
                "correlationId": {
                    "type": "string",
					"description": "correlationId"
                },
                "message": {
                    "type": "string",
					"description": "Unknown Error message"
                }
            },
            "required": [
                "time",
                "correlationId",
                "message"
            ],
			"example" : {
				"code": 1009,
				"status": 520,
				"time": "2017-01-13T13:24:51+05:30",
				"errors": [
					{  
						"code": 1009,
						"message": "Unfortunately some error occurred"
					}
				],
				"correlationId": "60f6c539-d344-4592-8675-409fc9ba0840",    
				"message": "Unfortunately some error occurred"
			}
        }
    }
}