Enterprise v1
Attach a child organization to an enterprise
deprecated
Deprecated. Superseded by the
/v3/enterpriseendpoints under the Enterprise tag.
Attaches an existing organization to an enterprise. The retention and owner field are optional, and will be defaulted if not specified. To specify which child organization to attach, one of its service keys must be supplied through our typical service key authorization schema; either as basic authorization or through the servicekey header.
POST
/
v1
/
enterprise
/
account
Attach a child organization to an enterprise
curl --request POST \
--url https://api.mezmo.com/v1/enterprise/account \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'enterprise-servicekey: <api-key>' \
--data '
{
"retention": 7,
"owner": "owner@example.org"
}
'import requests
url = "https://api.mezmo.com/v1/enterprise/account"
payload = {
"retention": 7,
"owner": "owner@example.org"
}
headers = {
"enterprise-servicekey": "<api-key>",
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'enterprise-servicekey': '<api-key>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({retention: 7, owner: 'owner@example.org'})
};
fetch('https://api.mezmo.com/v1/enterprise/account', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mezmo.com/v1/enterprise/account",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'retention' => 7,
'owner' => 'owner@example.org'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"enterprise-servicekey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mezmo.com/v1/enterprise/account"
payload := strings.NewReader("{\n \"retention\": 7,\n \"owner\": \"owner@example.org\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("enterprise-servicekey", "<api-key>")
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mezmo.com/v1/enterprise/account")
.header("enterprise-servicekey", "<api-key>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"retention\": 7,\n \"owner\": \"owner@example.org\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mezmo.com/v1/enterprise/account")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["enterprise-servicekey"] = '<api-key>'
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"retention\": 7,\n \"owner\": \"owner@example.org\"\n}"
response = http.request(request)
puts response.read_body{
"account": "0000000000",
"enterprise": "0000000000",
"retention": 7,
"owner": "owner@example.org",
"retentionPeriods": [
7
],
"plan": "enterprise",
"servicekey": "7b273eb8adc962f2711ad760730debb0"
}{
"error": "Service Key Validation Error: Invalid or deactivated servicekey",
"code": "BadRequest",
"status": "error"
}{
"code": "Conflict",
"error": "No contract found for this enterprise.",
"status": "error"
}Authorizations
enterpriseServiceKeyAuth & basicAuthenterpriseServiceKeyAuth & servicekeyAuth
(Deprecated) As an alternative to authenticating with a header value, you can also use basic authentication.
To use either apiKey or servicekey as basic authentication, simply pass the key
as the username with no password. For example:
curl https://api.logdna.com/v1/config/view -u INSERT_API_KEY:
Body
application/json
Request parameters.
Response
Child organization successfully attached.
Was this page helpful?
Attach a child organization to an enterprise
curl --request POST \
--url https://api.mezmo.com/v1/enterprise/account \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--header 'enterprise-servicekey: <api-key>' \
--data '
{
"retention": 7,
"owner": "owner@example.org"
}
'import requests
url = "https://api.mezmo.com/v1/enterprise/account"
payload = {
"retention": 7,
"owner": "owner@example.org"
}
headers = {
"enterprise-servicekey": "<api-key>",
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'enterprise-servicekey': '<api-key>',
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/json'
},
body: JSON.stringify({retention: 7, owner: 'owner@example.org'})
};
fetch('https://api.mezmo.com/v1/enterprise/account', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mezmo.com/v1/enterprise/account",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'retention' => 7,
'owner' => 'owner@example.org'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json",
"enterprise-servicekey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mezmo.com/v1/enterprise/account"
payload := strings.NewReader("{\n \"retention\": 7,\n \"owner\": \"owner@example.org\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("enterprise-servicekey", "<api-key>")
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.mezmo.com/v1/enterprise/account")
.header("enterprise-servicekey", "<api-key>")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"retention\": 7,\n \"owner\": \"owner@example.org\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mezmo.com/v1/enterprise/account")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["enterprise-servicekey"] = '<api-key>'
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"retention\": 7,\n \"owner\": \"owner@example.org\"\n}"
response = http.request(request)
puts response.read_body{
"account": "0000000000",
"enterprise": "0000000000",
"retention": 7,
"owner": "owner@example.org",
"retentionPeriods": [
7
],
"plan": "enterprise",
"servicekey": "7b273eb8adc962f2711ad760730debb0"
}{
"error": "Service Key Validation Error: Invalid or deactivated servicekey",
"code": "BadRequest",
"status": "error"
}{
"code": "Conflict",
"error": "No contract found for this enterprise.",
"status": "error"
}
