Kepla API

Relationships

Relationships tie together two records. They can bridge record types, or be within the same type and are categories by a taxonomy. Relationships show under a record in the app, and can be used in queries or lists. You can list, create and delete relationships.

List Relationships

Open in API Explorer
GET /relationships/:record

Returns a list of related records and their respective taxonomies for the specified record.

Example Request

Format:
curl --request GET \
  --url https://api.kepla.com/v1/relationships/:record \
  --header 'accept: application/json' \
  --header 'authorization: Bearer YOUR API KEY HERE'
require 'uri'
require 'net/http'

url = URI("https://api.kepla.com/v1/relationships/:record")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer YOUR API KEY HERE'

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "api.kepla.com",
  "port": null,
  "path": "/v1/relationships/:record",
  "headers": {
    "accept": "application/json",
    "authorization": "Bearer YOUR API KEY HERE"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
import http.client

conn = http.client.HTTPSConnection("api.kepla.com")

headers = {
    'accept': "application/json",
    'authorization': "Bearer YOUR API KEY HERE"
    }

conn.request("GET", "/v1/relationships/:record", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.kepla.com/v1/relationships/:record",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer YOUR API KEY HERE"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.kepla.com/v1/relationships/:record"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer YOUR API KEY HERE")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Path Parameters

Name Type Required Description Example
record String (uuid) Required

The record ID to retrieve relationships for

04fe9a97-a579-43c5-bb1a-58ed29bf0a6a

Responses

200 Success Relationships List
[
  "id": "25d78a92-5b36-4f49-98c7-472ba358b65c_5aa2220d-4997-4e47-a651-b9d44b63224f",
String
  "record": {
  "record": { ... }
Object
    "{fieldId}": "Field value",
String
    "createdAt": "2015-07-22T19:30:11.203Z",
String
    "id": "5aa2220d-4997-4e47-a651-b9d44b63224f",
String
    "typeId": "7806762b-2b30-4e12-bbe9-fafd6150cf4d",
String
    "updatedAt": "2016-07-19T11:06:54.313Z",
String
    "display": {
    "display": { ... }
Object
      "title": "Joe API",
String

The first value on the record by field order

      "subtitle": "[email protected]"
String

The second value on the record by field order

    }
  },
  "taxonomy": {
  "taxonomy": { ... }
Object
    "accountId": "e1f4cca4-1cbc-42cb-bb2f-5bbbab513f5c",
String
    "id": "77fc6c4b-cae9-4bb3-908f-62622a7842d5",
String
    "name": "Employee",
String
    "readonly": false,
Boolean

Reserved for system use

    "taxonomy": "relationship"
String
  }
]

Create a Relationship

Open in API Explorer
POST /relationships/:record

Creates a relationship between two records, associated with a relationship taxonomy

Example Request

Format:
curl --request POST \
  --url https://api.kepla.com/v1/relationships/:record \
  --header 'accept: application/json' \
  --header 'authorization: Bearer YOUR API KEY HERE' \
  --header 'content-type: application/json' \
  --data '{"related":"04fe9a97-a579-43c5-bb1a-58ed29bf0a6a","taxonomyId":"04fe9a97-a579-43c5-bb1a-58ed29bf0a6a"}'
require 'uri'
require 'net/http'

url = URI("https://api.kepla.com/v1/relationships/:record")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer YOUR API KEY HERE'
request["content-type"] = 'application/json'
request.body = "{\"related\":\"04fe9a97-a579-43c5-bb1a-58ed29bf0a6a\",\"taxonomyId\":\"04fe9a97-a579-43c5-bb1a-58ed29bf0a6a\"}"

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "api.kepla.com",
  "port": null,
  "path": "/v1/relationships/:record",
  "headers": {
    "accept": "application/json",
    "authorization": "Bearer YOUR API KEY HERE",
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ related: '04fe9a97-a579-43c5-bb1a-58ed29bf0a6a',
  taxonomyId: '04fe9a97-a579-43c5-bb1a-58ed29bf0a6a' }));
req.end();
import http.client

conn = http.client.HTTPSConnection("api.kepla.com")

payload = "{\"related\":\"04fe9a97-a579-43c5-bb1a-58ed29bf0a6a\",\"taxonomyId\":\"04fe9a97-a579-43c5-bb1a-58ed29bf0a6a\"}"

headers = {
    'accept': "application/json",
    'authorization': "Bearer YOUR API KEY HERE",
    'content-type': "application/json"
    }

conn.request("POST", "/v1/relationships/:record", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.kepla.com/v1/relationships/:record",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"related\":\"04fe9a97-a579-43c5-bb1a-58ed29bf0a6a\",\"taxonomyId\":\"04fe9a97-a579-43c5-bb1a-58ed29bf0a6a\"}",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer YOUR API KEY HERE",
    "content-type: application/json"
  ),
));

$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/ioutil"
)

func main() {

	url := "https://api.kepla.com/v1/relationships/:record"

	payload := strings.NewReader("{\"related\":\"04fe9a97-a579-43c5-bb1a-58ed29bf0a6a\",\"taxonomyId\":\"04fe9a97-a579-43c5-bb1a-58ed29bf0a6a\"}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer YOUR API KEY HERE")
	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Path Parameters

Name Type Required Description Example
record String (uuid) Required

The record ID of the base record.

04fe9a97-a579-43c5-bb1a-58ed29bf0a6a

Request Body

Name Type Required Description Example
payload Object Required
{
  "related": "04fe9a97-a579-43c5-bb1a-58ed29bf0a6a",
String (Uuid)

The record ID of the related item

  "taxonomyId": "04fe9a97-a579-43c5-bb1a-58ed29bf0a6a"
String (Uuid)

The taxonomy ID this relationship is associated with

}

Responses

201 Success Relationships Default
{
  "id": "04fe9a97-a579-43c5-bb1a-58ed29bf0a6a",
String (Uuid)

The relationship ID. You'll need this to delete the relationship.

  "taxonomyId": "04fe9a97-a579-43c5-bb1a-58ed29bf0a6a",
String (Uuid)

Associated taxonomy ID. Must be relationship taxonomy.

  "accountId": "04fe9a97-a579-43c5-bb1a-58ed29bf0a6a",
String (Uuid)
  "records": [
    "25d78a92-5b36-4f49-98c7-472ba358b65c",
    "25d78a92-5b36-4f49-98c7-472ba358b65c",
    "25d78a92-5b36-4f49-98c7-472ba358b65c"
  ]
Array

An array of the two related records

}

Delete a Relationship

Open in API Explorer
DELETE /relationships/:relationship

Deletes the specified relationship

Example Request

Format:
curl --request DELETE \
  --url https://api.kepla.com/v1/relationships/:relationship \
  --header 'accept: application/json' \
  --header 'authorization: Bearer YOUR API KEY HERE'
require 'uri'
require 'net/http'

url = URI("https://api.kepla.com/v1/relationships/:relationship")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Delete.new(url)
request["accept"] = 'application/json'
request["authorization"] = 'Bearer YOUR API KEY HERE'

response = http.request(request)
puts response.read_body
var http = require("https");

var options = {
  "method": "DELETE",
  "hostname": "api.kepla.com",
  "port": null,
  "path": "/v1/relationships/:relationship",
  "headers": {
    "accept": "application/json",
    "authorization": "Bearer YOUR API KEY HERE"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();
import http.client

conn = http.client.HTTPSConnection("api.kepla.com")

headers = {
    'accept': "application/json",
    'authorization': "Bearer YOUR API KEY HERE"
    }

conn.request("DELETE", "/v1/relationships/:relationship", headers=headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.kepla.com/v1/relationships/:relationship",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "DELETE",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Bearer YOUR API KEY HERE"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.kepla.com/v1/relationships/:relationship"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("accept", "application/json")
	req.Header.Add("authorization", "Bearer YOUR API KEY HERE")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}

Path Parameters

Name Type Required Description Example
relationship String (uuid) Required

The relationship ID to delete (returned with the relationship object)

04fe9a97-a579-43c5-bb1a-58ed29bf0a6a

Responses

204 Success (Empty Response)