Get all companies details
Return information about your all users.
All your companies data can be returned by GET
request to https://<your_app_subdomain>.user.com/api/public/companies/
GET
/companies/
curl -X GET -H "Authorization: Token <your_64_char_api_key>" "https://<your_app_subdomain>.user.com/api/public/companies/"
Response
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 1665,
"name": "Company from API 1",
"description": "Company created by API request",
"email": "company@email.com",
"country": "United States",
"region": null,
"city": "Beverly Hills",
"address": null,
"postal_code": "90210",
"approx_employees": null,
"created_at": "2017-07-06T15:32:10.090817Z",
"updated_at": "2017-07-06T15:32:10.090843Z",
"attributes": [
{
"id": 248896,
"name": "company attribute",
"name_std": "company_attribute",
"value": "my value 1"
},
{
"id": 248895,
"name": "company attribute 2",
"name_std": "company_attribute_2",
"value": "my value 1"
}
],
"phone_numbers": [
"13102990912",
"123456789"
],
"company_id": null
},
{
"id": 1662,
"name": "Company from API 2",
"description": "",
"email": "company@email.pl",
"country": "Poland",
"region": null,
"city": "Warsaw",
"address": null,
"postal_code": null,
"approx_employees": null,
"created_at": "2017-07-06T14:51:23.445206Z",
"updated_at": "2017-07-06T14:51:23.445228Z",
"attributes": [
{
"id": 123,
"name": "company attribute",
"name_std": "company_attribute",
"value": "my value 2"
},
{
"id": 1546,
"name": "company attribute 2",
"name_std": "company_attribute_2",
"value": "my value 2"
}
],
"phone_numbers": null,
"company_id": null
},
]
}
var settings = {
"async": true,
"crossDomain": true,
"url": "https://<your_app_subdomain>.user.com/api/public/companies/",
"method": "GET",
"headers": {
"authorization": "Token <your_64_char_api_key>"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://<your_app_subdomain>.user.com/api/public/companies/");
xhr.setRequestHeader("authorization", "Token <your_64_char_api_key>");
xhr.send(data);
var request = require("request");
var options = { method: 'GET',
url: 'https://<your_app_subdomain>.user.com/api/public/companies/',
headers: { authorization: 'Token <your_64_char_api_key>' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/companies/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => array(
"authorization: Token <your_64_char_api_key>"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://<your_app_subdomain>.user.com/api/public/companies/"
payload = ""
headers = {'authorization': 'Token <your_64_char_api_key>'}
response = requests.request("GET", url, data=payload, headers=headers)
print(response.text)
import http.client
conn = http.client.HTTPSConnection("<your_app_subdomain>.user.com")
payload = ""
headers = { 'authorization': "Token <your_64_char_api_key>" }
conn.request("GET", "/api/public/companies/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))