Requests
- shell
- http
- javascript
- ruby
- python
- java
- go
# You can also use wget
curl -X {HTTP Verb} https://TENANT_NAME.mambu.com/api/{Insert resource URI here} \
-H 'Accept: application/vnd.mambu.v2+json'
GET https://TENANT_NAME.mambu.com/api/Insert-Resource-URI-here HTTP/1.1
Host: TENANT_NAME.mambu.com
Accept: application/vnd.mambu.v2+json
var headers = {
'Accept':'application/vnd.mambu.v2+json'
};
$.ajax({
url: 'https://TENANT_NAME.mambu.com/api/{Insert resource URI here}',
method: '{HTTP Verb}',
headers: headers,
success: function(data) {
console.log(JSON.stringify(data));
}
})
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/vnd.mambu.v2+json'
}
result = RestClient.{HTTP Verb} 'https://TENANT_NAME.mambu.com/api/{Insert resource URI here}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/vnd.mambu.v2+json'
}
r = requests.{HTTP Verb}('https://TENANT_NAME.mambu.com/api/{Insert resource URI here}', params={
}, headers = headers)
print r.json()
URL obj = new URL("https://TENANT_NAME.mambu.com/api/{Insert resource URI here}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestProperty(“Accept”, “application/vnd.mambu.v2+json”);
con.setRequestMethod("{HTTP Verb}");
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{
"Accept": []string{"application/vnd.mambu.v2+json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("{HTTP Verb}", "https://TENANT_NAME.mambu.com/api/{Insert resource URI here}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
API requests (also known as API calls) to the Mambu API identify who the requester is and exactly what information they wish to retrieve or which action they wish to perform.
To put together an API request you will need to combine:
- The HTTP verb
- The full URI to the resource
- HTTP headers, for example, headers for authentication, versioning, and payload content types
- The payload (if required)