Subiz API

Departments

Departments Overview

{
  "id": "57306014af717600012ede78",
String

Department ID

  "name": "Marketing",
String

Department Name

  "status": "active"
String

Describes whether the department is enabled or not

}

List all departments

Open in API Explorer
GET /departments

This returns all departments created in your account

Example Request

Format:
curl --request GET \
  --url https://api.subiz.com/v1/departments \
  --header 'accept: application/json' \
  --header 'api-key: YOUR API KEY HERE'
require 'uri'
require 'net/http'

url = URI("https://api.subiz.com/v1/departments")

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["api-key"] = 'YOUR API KEY HERE'

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

var options = {
  "method": "GET",
  "hostname": "api.subiz.com",
  "port": null,
  "path": "/v1/departments",
  "headers": {
    "accept": "application/json",
    "api-key": "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.subiz.com")

headers = {
    'accept': "application/json",
    'api-key': "YOUR API KEY HERE"
    }

conn.request("GET", "/v1/departments", 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.subiz.com/v1/departments",
  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",
    "api-key: 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.subiz.com/v1/departments"

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

	req.Header.Add("accept", "application/json")
	req.Header.Add("api-key", "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))

}

Responses

200 OK

OK

Departments List departments
[
  "id": "57306014af717600012ede78",
String

Department ID

  "name": "Marketing",
String

Department Name

  "status": "active"
String

Describes whether the department is enabled or not

]

Create a department

Open in API Explorer
POST /departments

Allows owner/administrator to add more departments

Example Request

Format:
curl --request POST \
  --url https://api.subiz.com/v1/departments \
  --header 'accept: application/json' \
  --header 'api-key: YOUR API KEY HERE' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form name=Marketing \
  --form status=active
require 'uri'
require 'net/http'

url = URI("https://api.subiz.com/v1/departments")

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["api-key"] = 'YOUR API KEY HERE'
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nMarketing\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"status\"\r\n\r\nactive\r\n-----011000010111000001101001--\r\n"

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

var options = {
  "method": "POST",
  "hostname": "api.subiz.com",
  "port": null,
  "path": "/v1/departments",
  "headers": {
    "accept": "application/json",
    "api-key": "YOUR API KEY HERE",
    "content-type": "multipart/form-data; boundary=---011000010111000001101001"
  }
};

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("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nMarketing\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"status\"\r\n\r\nactive\r\n-----011000010111000001101001--\r\n");
req.end();
import http.client

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

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nMarketing\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"status\"\r\n\r\nactive\r\n-----011000010111000001101001--\r\n"

headers = {
    'accept': "application/json",
    'api-key': "YOUR API KEY HERE",
    'content-type': "multipart/form-data; boundary=---011000010111000001101001"
    }

conn.request("POST", "/v1/departments", 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.subiz.com/v1/departments",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nMarketing\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"status\"\r\n\r\nactive\r\n-----011000010111000001101001--\r\n",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "api-key: YOUR API KEY HERE",
    "content-type: multipart/form-data; boundary=---011000010111000001101001"
  ),
));

$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.subiz.com/v1/departments"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nMarketing\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"status\"\r\n\r\nactive\r\n-----011000010111000001101001--\r\n")

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

	req.Header.Add("accept", "application/json")
	req.Header.Add("api-key", "YOUR API KEY HERE")
	req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")

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

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

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

}

Form Data Parameters

Name Type Required Description Example
name String Required

Name

Marketing
status String Required

Status

active

Responses

201 Created

Created

Departments Department
{
  "id": "57306014af717600012ede78",
String

Department ID

  "name": "Marketing",
String

Department Name

  "status": "active"
String

Describes whether the department is enabled or not

}

Retrieve a department

Open in API Explorer
GET /departments/{department_id}

Fetches a department by its ID.

Example Request

Format:
curl --request GET \
  --url https://api.subiz.com/v1/departments/57300decaf7176000147fceb \
  --header 'accept: application/json' \
  --header 'api-key: YOUR API KEY HERE'
require 'uri'
require 'net/http'

url = URI("https://api.subiz.com/v1/departments/57300decaf7176000147fceb")

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["api-key"] = 'YOUR API KEY HERE'

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

var options = {
  "method": "GET",
  "hostname": "api.subiz.com",
  "port": null,
  "path": "/v1/departments/57300decaf7176000147fceb",
  "headers": {
    "accept": "application/json",
    "api-key": "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.subiz.com")

headers = {
    'accept': "application/json",
    'api-key': "YOUR API KEY HERE"
    }

conn.request("GET", "/v1/departments/57300decaf7176000147fceb", 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.subiz.com/v1/departments/57300decaf7176000147fceb",
  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",
    "api-key: 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.subiz.com/v1/departments/57300decaf7176000147fceb"

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

	req.Header.Add("accept", "application/json")
	req.Header.Add("api-key", "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
department_id String (string) Required

Department ID

57300decaf7176000147fceb

Responses

200 OK

OK

Departments Department
{
  "id": "57306014af717600012ede78",
String

Department ID

  "name": "Marketing",
String

Department Name

  "status": "active"
String

Describes whether the department is enabled or not

}

Update a department

Open in API Explorer
PUT /departments/{department_id}

Allows owner/administrator to update department details

Example Request

Format:
curl --request PUT \
  --url https://api.subiz.com/v1/departments/57300decaf7176000147fceb \
  --header 'accept: application/json' \
  --header 'api-key: YOUR API KEY HERE' \
  --header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
  --form name=Marketing \
  --form status=inactive
require 'uri'
require 'net/http'

url = URI("https://api.subiz.com/v1/departments/57300decaf7176000147fceb")

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

request = Net::HTTP::Put.new(url)
request["accept"] = 'application/json'
request["api-key"] = 'YOUR API KEY HERE'
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nMarketing\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"status\"\r\n\r\ninactive\r\n-----011000010111000001101001--\r\n"

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

var options = {
  "method": "PUT",
  "hostname": "api.subiz.com",
  "port": null,
  "path": "/v1/departments/57300decaf7176000147fceb",
  "headers": {
    "accept": "application/json",
    "api-key": "YOUR API KEY HERE",
    "content-type": "multipart/form-data; boundary=---011000010111000001101001"
  }
};

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("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nMarketing\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"status\"\r\n\r\ninactive\r\n-----011000010111000001101001--\r\n");
req.end();
import http.client

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

payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nMarketing\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"status\"\r\n\r\ninactive\r\n-----011000010111000001101001--\r\n"

headers = {
    'accept': "application/json",
    'api-key': "YOUR API KEY HERE",
    'content-type': "multipart/form-data; boundary=---011000010111000001101001"
    }

conn.request("PUT", "/v1/departments/57300decaf7176000147fceb", 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.subiz.com/v1/departments/57300decaf7176000147fceb",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nMarketing\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"status\"\r\n\r\ninactive\r\n-----011000010111000001101001--\r\n",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "api-key: YOUR API KEY HERE",
    "content-type: multipart/form-data; boundary=---011000010111000001101001"
  ),
));

$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.subiz.com/v1/departments/57300decaf7176000147fceb"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nMarketing\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"status\"\r\n\r\ninactive\r\n-----011000010111000001101001--\r\n")

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

	req.Header.Add("accept", "application/json")
	req.Header.Add("api-key", "YOUR API KEY HERE")
	req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")

	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
department_id String (string) Required

Department ID

57300decaf7176000147fceb

Form Data Parameters

Name Type Required Description Example
name String (string) Required

Name

Marketing
status String (string) Required

Status

inactive

Responses

200 OK

OK

Departments Department
{
  "id": "57306014af717600012ede78",
String

Department ID

  "name": "Marketing",
String

Department Name

  "status": "active"
String

Describes whether the department is enabled or not

}

Delete a department

Open in API Explorer
DELETE /departments/{department_id}

Allows an owner/administrator to delete a department

Example Request

Format:
curl --request DELETE \
  --url https://api.subiz.com/v1/departments/57300decaf7176000147fceb \
  --header 'accept: application/json' \
  --header 'api-key: YOUR API KEY HERE'
require 'uri'
require 'net/http'

url = URI("https://api.subiz.com/v1/departments/57300decaf7176000147fceb")

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["api-key"] = 'YOUR API KEY HERE'

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

var options = {
  "method": "DELETE",
  "hostname": "api.subiz.com",
  "port": null,
  "path": "/v1/departments/57300decaf7176000147fceb",
  "headers": {
    "accept": "application/json",
    "api-key": "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.subiz.com")

headers = {
    'accept': "application/json",
    'api-key': "YOUR API KEY HERE"
    }

conn.request("DELETE", "/v1/departments/57300decaf7176000147fceb", 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.subiz.com/v1/departments/57300decaf7176000147fceb",
  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",
    "api-key: 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.subiz.com/v1/departments/57300decaf7176000147fceb"

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

	req.Header.Add("accept", "application/json")
	req.Header.Add("api-key", "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
department_id String (string) Required

Department ID

57300decaf7176000147fceb

Responses

204 No Content

Department deleted successfully

(Empty Response)