[
    {
      "swagger": "2.0",
      "info": {
        "title": "Routes",
        "x-ibm-name": "routes",
        "version": "1.0.0",
        "description": "The /v1 set of Routes APIs",
        "termsOfService": "The Terms of Service for the API are ...",
        "contact": {
          "name": "Joe API Developer",
          "url": "http://developer.acme.com/contacturl",
          "email": "joedeveloper@someemailservice.com"
        },
        "license": {
          "name": "License Name Goes Here...",
          "url": "http://developer.acme.com/licenseurl"
        }
      },
      "schemes": [
        "https"
      ],
      "host": "api.goclimbarock.com",
      "basePath": "/v1",
      "consumes": [
        "application/json"
      ],
      "produces": [
        "application/json"
      ],
      "securityDefinitions": {
        "api-key-header": {
          "type": "apiKey",
          "in": "header",
          "name": "client_id"
        },
        "api-key-query-parameter": {
          "type": "apiKey",
          "in": "query",
          "name": "client_id"
        },
        "api-secret-header": {
          "type": "apiKey",
          "in": "header",
          "name": "client_secret"
        },
        "api-secret-query-parameter": {
          "type": "apiKey",
          "in": "query",
          "name": "client_secret"
        },
        "basic-authentication": {
          "type": "basic",
          "x-ibm-basic-auth": {
            "authentication-registry": "some-registry-configuration-name"
          }
        }
      },
      "security": [
        {
          "api-key-header": [],
          "api-key-query-parameter": [],
          "api-secret-header": [],
          "api-secret-query-parameter": [],
          "basic-authentication": []
        }
      ],
      "x-ibm-configuration": {
        "policy": {
          "assembly": [
            {
              "security": {
                "title": "Security",
                "requirements": [
                  {
                    "api-key-header": [],
                    "api-secret-header": [],
                    "basic-authentication": []
                  },
                  {
                    "api-key-query-parameter": [],
                    "api-secret-query-parameter": [],
                    "basic-authentication": []
                  },
                  {
                    "api-key-query-parameter": [],
                    "api-secret-header": [],
                    "basic-authentication": []
                  },
                  {
                    "api-key-header": [],
                    "api-secret-query-parameter": [],
                    "basic-authentication": []
                  }
                ]
              }
            },
            {
              "rate-limit": {
                "title": "Rate Limit",
                "description": "Rate limit verificiation",
                "value": "$(plan.rate-limit)"
              }
            },
            {
              "activity": {
                "title": "Analytics",
                "description": "Log the path/headers to analytics and full payload upon errors",
                "content": "activity",
                "error-content": "payload"
              }
            },
            {
              "operation-switch": {
                "title": "If Operation has a Request Payload",
                "description": "Validate payload and convert XML payloads to JSON for /routes create/update operations",
                "case": [
                  {
                    "operations": [
                      "createRoute",
                      "updateRoute"
                    ],
                    "execute": [
                      {
                        "rest-validation": {
                          "title": "Validate Request",
                          "input-headers": "$(request.headers)",
                          "input-body": "$(request.body)"
                        }
                      },
                      {
                        "if": {
                          "title": "If Content-Type Header is XML",
                          "condition": "request.headers.contentType === 'application/xml'",
                          "execute": [
                            {
                              "xml-to-json": {
                                "title": "XML to JSON",
                                "input-body": "$(request.body)",
                                "output-body": "$(request.body)"
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                ]
              }
            },
            {
              "set-variable": {
                "title": "Invoke Routes Preparation",
                "variables": [
                  {
                    "name": "$(context.variable.routes-service-request-headers)",
                    "value": "$(request.headers)"
                  },
                  {
                    "name": "$(context.variable.routes-service-request-headers.client_id)",
                    "value": null
                  },
                  {
                    "name": "$(context.variable.routes-service-request-headers.Location)",
                    "value": "San Jose"
                  },
                  {
                    "name": "$(context.variable.routes-service-request-headers.TimeOfDay)",
                    "value": "Noon"
                  }
                ]
              }
            },
            {
              "invoke": {
                "title": "Invoke Routes",
                "description": "Invoke the respective downstream /routes or /routes/{id} service",
                "target-url": "https://climbon-$(api.env.name).mybluemix.net",
                "input-headers": "$(context.variable.routes-service-request-headers)",
                "input-body": "$(request.body)",
                "output-body": "$(response.body)",
                "output-headers": "$(response.headers)",
                "tls-profile": "tls-profile-name",
                "apply": [
                  {
                    "basic-authentication": {
                      "profile": "some-connection-name-with-name-and-password-credentials-and-tls-..."
                    }
                  },
                  {
                    "saml-generation": null
                  },
                  {
                    "compression": null
                  }
                ],
                "catch": [
                  {
                    "errors": [
                      "authentication-error"
                    ],
                    "execute": [
                      {
                        "set-variable": [
                          {
                            "name": "response.header.status",
                            "value": 401
                          },
                          {
                            "name": "response.body",
                            "value": "{ status: 401, message: 'Error authenticating ...' }"
                          }
                        ]
                      },
                      {
                        "throw": {
                          "error": "invoke-error"
                        }
                      }
                    ]
                  },
                  {
                    "default": [
                      {
                        "set-variable": {
                          "variables": [
                            {
                              "name": "response.header.status",
                              "value": "$(response.headers.status)"
                            },
                            {
                              "name": "response.body",
                              "value": "{ status: '$(response.headers.status)', message: 'Error invoking routes: $(response.body.error)' }"
                            }
                          ]
                        }
                      },
                      {
                        "throw": {
                          "error": "invoke-error"
                        }
                      }
                    ]
                  }
                ]
              }
            },
            {
              "operation-switch": {
                "title": "If Operation has a Response Payload",
                "case": [
                  {
                    "operations": [
                      "createRoute",
                      "listRoutes",
                      "getRoute",
                      "updateRoute"
                    ],
                    "execute": [
                      {
                        "if": {
                          "title": "If Accept Header is XML",
                          "condition": "request.headers.accept === 'application/xml'",
                          "execute": [
                            {
                              "set-variable": {
                                "variables": [
                                  {
                                    "name": "response.header.content-type",
                                    "value": "application/xml"
                                  }
                                ]
                              }
                            },
                            {
                              "json-to-xml": {
                                "title": "JSON to XML",
                                "input-body": "$(response.body)",
                                "output-body": "$(response.body)"
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                ]
              }
            },
            {
              "operation-switch": {
                "case": [
                  {
                    "operations": [
                      "createRoute",
                      "listRoutes",
                      "getRoute",
                      "updateRoute"
                    ],
                    "execute": [
                      {
                        "response": {
                          "headers": "$(response.headers)",
                          "body": "$(response.body)"
                        }
                      }
                    ]
                  },
                  {
                    "operations": [
                      "deleteRoutes"
                    ],
                    "execute": [
                      {
                        "response": {
                          "headers": "$(response.headers)",
                          "body": null
                        }
                      }
                    ]
                  }
                ]
              }
            }
          ],
          "catch": [
            {
              "errors": [
                "invoke-error"
              ],
              "execute": [
                {
                  "response": {
                    "headers": "$(response.headers)",
                    "body": "$(response.body)"
                  }
                }
              ]
            },
            {
              "default": [
                {
                  "set-variable": {
                    "variables": [
                      {
                        "name": "response.headers.status",
                        "value": 500
                      },
                      {
                        "name": "response.headers.content-type",
                        "value": "application/json"
                      }
                    ]
                  }
                },
                {
                  "response": {
                    "headers": "$(response.headers)",
                    "body": "{ status: 500, message: 'Unknown server error during routes-reviews invocation' }"
                  }
                }
              ]
            }
          ]
        },
        "sdks": [
          "php",
          "java",
          "python"
        ],
        "attachments": [
          {
            "title": "Information for partners",
            "url": "http://developer.acme.com/partners"
          }
        ]
      },
      "tags": [
        {
          "name": "routes",
          "description": "This is a cool tag",
          "externalDocs": {
            "description": "Blah",
            "url": "http://host/url-of-my-entire-set-of-tag-docs-for-this-tag"
          }
        },
        {
          "name": "blah",
          "description": "This is a cooler tag",
          "externalDocs": {
            "description": "Blah",
            "url": "http://host/url-of-my-entire-set-of-tag-docs-for-this-tag"
          }
        }
      ],
      "externalDocs": {
        "description": "Blah",
        "url": "http://host/url-of-my-entire-set-of-api-docs"
      },
      "paths": {
        "/routes": {
          "post": {
            "summary": "Create a Route",
            "description": "Create a Route",
            "externalDocs": {
              "description": "Blah",
              "url": "http://host/docs-about-routes-post"
            },
            "tags": [
              "Routes"
            ],
            "parameters": [
              {
                "name": "payload",
                "in": "body",
                "description": "Route to create",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/RouteCreate"
                }
              }
            ],
            "responses": {
              "201": {
                "description": "Successful create",
                "headers": [
                  {
                    "Location": {
                      "description": "The location of the newly created object",
                      "type": "string"
                    }
                  }
                ],
                "schema": {
                  "$ref": "#/definitions/Route"
                }
              },
              "default": {
                "description": "Unexpected error",
                "schema": {
                  "$ref": "#/definitions/Error"
                }
              }
            }
          },
          "get": {
            "summary": "List Routes",
            "description": "List Routes",
            "operationId": "list",
            "security": [],
            "tags": [
              "Routes"
            ],
            "parameters": [
              {
                "name": "offset",
                "in": "query",
                "description": "What element to start the list at, default is 0",
                "required": false,
                "type": "string"
              },
              {
                "name": "limit",
                "in": "query",
                "description": "Total number of items to return, default is 10",
                "required": false,
                "type": "string"
              }
            ],
            "responses": {
              "200": {
                "description": "Success",
                "schema": {
                  "$ref": "#/definitions/RouteList"
                }
              },
              "default": {
                "description": "Unexpected error",
                "schema": {
                  "$ref": "#/definitions/Error"
                }
              }
            }
          }
        },
        "/routes/{route}": {
          "get": {
            "summary": "Retrieve the Route",
            "description": "Retrieve the Route",
            "tags": [
              "Routes"
            ],
            "parameters": [
              {
                "name": "route",
                "in": "path",
                "description": "Route id",
                "required": true,
                "type": "string"
              },
              {
                "name": "fields",
                "in": "query",
                "description": "Return a subset of the fields",
                "required": false,
                "type": "string"
              }
            ],
            "responses": {
              "200": {
                "description": "Success",
                "schema": {
                  "$ref": "#/definitions/Route"
                }
              },
              "default": {
                "description": "Unexpected error",
                "schema": {
                  "$ref": "#/definitions/Error"
                }
              }
            }
          },
          "put": {
            "summary": "Update Route",
            "description": "Update Route",
            "tags": [
              "Routes"
            ],
            "parameters": [
              {
                "name": "route",
                "in": "path",
                "description": "Route id",
                "required": true,
                "type": "string"
              },
              {
                "name": "payload",
                "in": "body",
                "description": "Route to update",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/RouteUpdate"
                }
              }
            ],
            "responses": {
              "200": {
                "description": "Success",
                "schema": {
                  "$ref": "#/definitions/Route"
                }
              },
              "default": {
                "description": "Unexpected error",
                "schema": {
                  "$ref": "#/definitions/Error"
                }
              }
            }
          },
          "delete": {
            "summary": "Delete the Route",
            "description": "Delete the Route",
            "operationId": "del",
            "tags": [
              "Routes"
            ],
            "parameters": [
              {
                "name": "route",
                "in": "path",
                "description": "Route id",
                "required": true,
                "type": "string"
              }
            ],
            "responses": {
              "204": {
                "description": "Successful delete"
              },
              "default": {
                "description": "Unexpected error",
                "schema": {
                  "$ref": "#/definitions/Error"
                }
              }
            }
          }
        }
      },
      "definitions": {
        "Route": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string"
            },
            "type": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "difficulty": {
              "type": "string"
            },
            "height": {
              "type": "string"
            },
            "pitches": {
              "type": "integer"
            },
            "fa": {
              "type": "string"
            },
            "ffa": {
              "type": "string"
            },
            "ffs": {
              "type": "string"
            },
            "style": {
              "type": "string"
            },
            "url": {
              "type": "string"
            },
            "created_at": {
              "type": "string",
              "format": "date-time"
            },
            "modified_at": {
              "type": "string",
              "format": "date-time"
            },
            "url_hierarchy": {
              "type": "string"
            },
            "route": {
              "type": "object"
            }
          }
        },
        "RouteCreate": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "name"
          ],
          "properties": {
            "name": {
              "type": "string"
            },
            "difficulty": {
              "type": "string"
            },
            "height": {
              "type": "string"
            },
            "pitches": {
              "type": "integer"
            },
            "fa": {
              "type": "string"
            },
            "ffa": {
              "type": "string"
            },
            "ffs": {
              "type": "string"
            },
            "style": {
              "type": "string"
            }
          }
        },
        "RouteUpdate": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "name": {
              "type": "string"
            },
            "difficulty": {
              "type": "string"
            },
            "height": {
              "type": "string"
            },
            "pitches": {
              "type": "integer"
            },
            "fa": {
              "type": "string"
            },
            "ffa": {
              "type": "string"
            },
            "ffs": {
              "type": "string"
            },
            "style": {
              "type": "string"
            }
          }
        },
        "RouteList": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "total_results": {
              "type": "integer"
            },
            "results": {
              "type": "array",
              "items": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "difficulty": {
                      "type": "string"
                    },
                    "height": {
                      "type": "string"
                    },
                    "pitches": {
                      "type": "integer"
                    },
                    "fa": {
                      "type": "string"
                    },
                    "ffa": {
                      "type": "string"
                    },
                    "ffs": {
                      "type": "string"
                    },
                    "style": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "modified_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "url_hierarchy": {
                      "type": "string"
                    },
                    "route": {
                      "type": "object"
                    }
                  }
                }
              ]
            }
          }
        },
        "Error": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "status": {
              "type": "integer"
            },
            "message": {
              "type": [
                "string",
                "array"
              ]
            }
          }
        }
      }
  },{
      "swagger": 2,
      "info": {
        "title": "Ascents",
        "x-ibm-name": "ascents",
        "version": "1.0.0",
        "description": "The /v1 set of Ascent APIs",
        "termsOfService": "The Terms of Service for the API are ...",
        "contact": {
          "name": "Joe API Developer",
          "url": "http://developer.acme.com/contacturl",
          "email": "joedeveloper@someemailservice.com"
        },
        "license": {
          "name": "License Name Goes Here...",
          "url": "http://developer.acme.com/licenseurl"
        }
      },
      "schemes": [
        "http"
      ],
      "host": "localhost:3000",
      "basePath": "/v1",
      "consumes": [
        "application/json"
      ],
      "produces": [
        "application/json"
      ],
      "x-ibm-configuration": {
        "phase": "realized",
        "testable": true,
        "enforced": true,
        "clientSdkLibraries": [
          "php",
          "java",
          "python"
        ]
      },
      "securityDefinitions": {
        "oauthImplicit": {
          "type": "oauth2",
          "authorizationUrl": "http://swagger.io/api/oauth/dialog",
          "flow": "implicit",
          "scopes": {
            "scope1": "blah description",
            "scope2": "blah blah description"
          },
          "x-ibm-oauth2": {
            "authentication": [
              "basicAuth",
              "form"
            ],
            "authenticationForm": {
              "url": "https://somehost.com/authenticate",
              "tlsClient": "Some SSL Profile Configuration Name"
            },
            "authenticationRegistry": "Some Registry Configuration Name",
            "authenticationUrl": {
              "url": "https://somehost.com/authenticate",
              "tlsClient": "Some SSL Profile Configuration Name"
            },
            "authorization": "form",
            "authorizationForm": {
              "url": "https://somehost.com/authorization",
              "tlsClient": "Some SSL Profile Configuration Name"
            },
            "refreshToken": false,
            "revocationUrl": {
              "url": "https://somehost.com/revoke",
              "tlsClient": "Some SSL Profile Configuration Name"
            }
          }
        }
      },
      "security": null,
      "paths": {
        "/ascents": {
          "post": {
            "summary": "Create a Ascent",
            "description": "Create a Ascent",
            "operationId": "createAscent",
            "tags": [
              "Ascent"
            ],
            "parameters": [
              {
                "name": "payload",
                "in": "body",
                "description": "Ascent to create",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/AscentCreate"
                }
              }
            ],
            "responses": {
              "201": {
                "description": "Successful create",
                "schema": {
                  "$ref": "#/definitions/Ascent"
                }
              },
              "default": {
                "description": "Unexpected error",
                "schema": {
                  "$ref": "#/definitions/Error"
                }
              }
            }
          },
          "get": {
            "summary": "List Ascent",
            "description": "List Ascent",
            "operationId": "listAscents",
            "tags": [
              "Ascent"
            ],
            "parameters": [
              {
                "name": "offset",
                "in": "query",
                "description": "What element to start the list at, default is 0",
                "required": false,
                "type": "string"
              },
              {
                "name": "limit",
                "in": "query",
                "description": "Total number of items to return, default is 10",
                "required": false,
                "type": "string"
              }
            ],
            "responses": {
              "200": {
                "description": "Success",
                "schema": {
                  "$ref": "#/definitions/AscentList"
                }
              },
              "default": {
                "description": "Unexpected error",
                "schema": {
                  "$ref": "#/definitions/Error"
                }
              }
            }
          }
        },
        "/ascents/{ascent}": {
          "get": {
            "summary": "Retrieve the Ascent",
            "description": "Retrieve the Ascent",
            "operationId": "getAscent",
            "tags": [
              "Ascent"
            ],
            "parameters": [
              {
                "name": "ascent",
                "in": "path",
                "description": "Ascent id",
                "required": true,
                "type": "string"
              },
              {
                "name": "fields",
                "in": "query",
                "description": "Return a subset of the fields",
                "required": false,
                "type": "string"
              }
            ],
            "responses": {
              "200": {
                "description": "Success",
                "schema": {
                  "$ref": "#/definitions/Ascent"
                }
              },
              "default": {
                "description": "Unexpected error",
                "schema": {
                  "$ref": "#/definitions/Error"
                }
              }
            }
          },
          "put": {
            "summary": "Update Ascent",
            "description": "Update Ascent",
            "operationId": "updateAscent",
            "tags": [
              "Ascent"
            ],
            "parameters": [
              {
                "name": "ascent",
                "in": "path",
                "description": "Ascent id",
                "required": true,
                "type": "string"
              },
              {
                "name": "payload",
                "in": "body",
                "description": "Ascent to update",
                "required": true,
                "schema": {
                  "$ref": "#/definitions/AscentUpdate"
                }
              }
            ],
            "responses": {
              "200": {
                "description": "Success",
                "schema": {
                  "$ref": "#/definitions/Ascent"
                }
              },
              "default": {
                "description": "Unexpected error",
                "schema": {
                  "$ref": "#/definitions/Error"
                }
              }
            }
          },
          "delete": {
            "summary": "Delete the Ascent",
            "description": "Delete the Ascent",
            "operationId": "deleteAscent",
            "tags": [
              "Ascent"
            ],
            "parameters": [
              {
                "name": "ascent",
                "in": "path",
                "description": "Ascent id",
                "required": true,
                "type": "string"
              }
            ],
            "responses": {
              "204": {
                "description": "Successful delete"
              },
              "default": {
                "description": "Unexpected error",
                "schema": {
                  "$ref": "#/definitions/Error"
                }
              }
            }
          }
        }
      },
      "definitions": {
        "Ascent": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string"
            },
            "route": {
              "type": "string"
            },
            "date": {
              "type": "string"
            }
          }
        },
        "AscentCreate": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "route"
          ],
          "properties": {
            "route": {
              "type": "string"
            },
            "date": {
              "type": "string"
            }
          }
        },
        "AscentUpdate": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "route": {
              "type": "string"
            },
            "date": {
              "type": "string"
            }
          }
        },
        "AscentList": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "total_results": {
              "type": "integer"
            },
            "results": {
              "type": "array",
              "items": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "route": {
                      "type": "string"
                    },
                    "date": {
                      "type": "string"
                    }
                  }
                }
              ]
            }
          }
        },
        "Error": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "status": {
              "type": "integer"
            },
            "message": {
              "type": [
                "string",
                "array"
              ]
            }
          }
        }
      }
    }
]
