Retrieving v2 OAS Files
- shell
- http
- js
- ruby
- java
- go
- response
# You can also use wget
curl -X GET https://TENANT_NAME.mambu.com/api/swagger/completejson/{OAS-file} \
-u 'username:password'
GET https://TENANT_NAME.mambu.com/api/swagger/completejson/{OAS-file} HTTP/1.1
Host: TENANT_NAME.mambu.com
Authorization: Basic <credentials>
var headers = {
'Authorization':'Basic <credentials>'
};
$.ajax({
url: 'https://TENANT_NAME.mambu.com/api/swagger/completejson/{OAS-file}',
method: 'GET',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
require 'rest-client'
require 'json'
headers = {
'Authorization' => 'Basic <credentials>'
}
result = RestClient.get 'https://TENANT_NAME.mambu.com/api/swagger/completejson/{OAS-file}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Authorization': 'Basic <credentials>'
}
r = requests.get('https://TENANT_NAME.mambu.com/api/swagger/completejson/{OAS-file}', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://TENANT_NAME.mambu.com/api/swagger/completejson/{OAS-file}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestProperty("Authorization", "Basic <credentials>");
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Authorization": []string{"Basic <credentials>"}
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://TENANT_NAME.mambu.com/api/swagger/completejson/{OAS-file}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
Example response
{
"swagger": "2.0",
"info": {
"version": "v2",
"title": "clients"
},
"host": "localhost:8889",
"basePath": "/api",
"tags": [
{
"name": "Clients",
"description": "Allows you to retrieve, create, update, or delete clients. Clients may have associated information such as their address, identification documents, or custom field values."
}
],
"schemes": [
"http",
"https"
],
"paths": {
...
},
"securityDefinitions": {
"basic": {
"description": "",
"type": "basic"
}
},
"definitions": {
...
}
}
Once you have followed the steps to retrieve the jsonPath value for a specific API, you can build the path to a specific resource.
To retrieve the specification file for a given API, join the base URL with the value of the relevant jsonPath.