Hub Culture Developer Portal


HubID API

  • Created : Feb, 04, 2016
  • Last Updated: April, 15, 2016

Hub Culture connects various authorities, third parties and users. The identity API gives users control over who has access to their information, and a means for third parties to access and identify users and the services they subscribe to.This API is designed to provide free public information about Ven pricing relative to other currencies.

API Overview


current version: 1.0.3
update frequency: realtime
protocols: REST, JSON, JWT
endpoint: https://id.hubculture.com
swagger: https://api.hubculture.com

Developer keys

To use the methods of the api is necessary to activate the role of the "Developer" and generate developer keys.
To activate the role of the developer buy it in the section "Memberships", then go to the page role. The keys of your application will be displayed on this page.

JWT tokens

This application uses JWT token for client authentication. The short lifetime of the token 1 hour. it must be extended by the expiration of this time. Total lifetime of the token 14 days.
The method of obtaining a token: GET /auth need public api key
Method extension token: PUT /token need public api key.

Methods

Auth


The group of methods allows to authenticate the user or create a new account
Swagger: Auth methods , need public api key

Users

The group of methods allows you to create user, update information, view information about the user.
Swagger: Users methods , need private api key

Friends

The group of methods allows you to manage a list of friends.
Swagger: Friends methods , need private api key

Transactions

The group of methods allows you to view the balance, perform and track transaction.
Swagger: Transactions methods , need private api key

Alerts

The group of methods allows you to manage a list of notifications.
Swagger: Alerts methods , need private api key

Messages

The group of methods allows you to manage the list of messages.
Swagger: Messages methods , need private api key

PHP Example

PHP library

Get token

Request

 /*
 * Get token
 */
// request url
$url = 'https://id.hubculture.com/auth?email=USER_EMAIL&password=USER_PASSWORD';
// set public key in header
$formatHeaders = array();
$headers = array(
    'Public-Key' => 'PUBLIC_KEY'
);
foreach ($headers as $header => $value) {
    $formatHeaders[] = $header.': '.trim($value);
}

// send request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $formatHeaders);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = json_decode(curl_exec($ch));

var_dump($response);
                 

Response

object(stdClass)#1 (8) {
  ["api"]=>
  string(3) "jwt"
  ["desc"]=>
  string(21) "Json Web Token format"
  ["links"]=>
  object(stdClass)#2 (1) {
    ["self"]=>
    string(78) "https://id.hubculture.com/auth?email=USER_EMAIL&password=USER_PASSWORD"
  }
  ["status"]=>
  string(7) "success"
  ["errors"]=>
  array(0) {
  }
  ["data"]=>
  object(stdClass)#3 (2) {
    ["token"]=>
    string(280) "AUTH_TOKEN"
    ["user_id"]=>
    string(4) "USER_ID"
  }
  ["code"]=>
  int(200)
  ["time"]=>
  int(1479206181)
}
                 

Get current user info

Request

/*
 * Get current user info
 */
// request url
$url = 'https://id.hubculture.com/user';
// set public key in header
$formatHeaders = array();
$headers = array(
    'Private-Key' => 'PRIVATE_KEY',
    'Authorization' => 'Bearer '.'AUTH_TOKEN',
);
foreach ($headers as $header => $value) {
    $formatHeaders[] = $header.': '.trim($value);
}

// send request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $formatHeaders);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = json_decode(curl_exec($ch));

var_dump($response);
                 

Response

object(stdClass)#1 (8) {
  ["api"]=>
  string(3) "jwt"
  ["desc"]=>
  string(21) "Json Web Token format"
  ["links"]=>
  object(stdClass)#2 (1) {
    ["self"]=>
    string(31) "https://id.hubculture.com/user"
  }
  ["status"]=>
  string(7) "success"
  ["errors"]=>
  array(0) {
  }
  ["data"]=>
  object(stdClass)#3 (12) {
    ["id"]=>
    string(4) "ID"
    ["name"]=>
    string(5) "NAME"
    ........
    }
  }
  ["code"]=>
  int(200)
  ["time"]=>
  int(1479206755)
}