All REST requests must contain the following headers:
BB-ACCESS-KEY
The api key as a string.
BB-ACCESS-SIGN
The base64-encoded signature (see Signing a Message).
BB-ACCESS-TIMESTAMP
A timestamp for your request.
All request bodies should have content type application/json and be valid JSON.
The BB-ACCESS-SIGN header is generated by creating a sha256 HMAC using the base64-decoded secret key on the prehash string timestamp + method + requestPath + body (where + represents string concatenation) and base64-encode the output. The timestamp value is the same as the BB-ACCESS-TIMESTAMP header. The body is the request body string or omitted if there is no request body (typically for GET requests).
The CB-ACCESS-TIMESTAMP header MUST be number of seconds since Unix Epoch in UTC. Decimal values are allowed. Your timestamp must be within 30 seconds of the api service time or your request will be considered expired and rejected. We recommend using the time endpoint to query for the API server time if you believe there many be time skew between your server and the API servers.
class shivexexchangeAuth(AuthBase):
def __init__(self, api_key, secret_key):
self.api_key = api_key
self.secret_key = secret_key
def __call__(self, request):
timestamp = str(time.time())
message = timestamp + request.method.lower() + request.path_url + (request.body or '')
hmac_key = base64.b64decode(self.secret_key)
signature = hmac.new(hmac_key, message, hashlib.sha256)
signature_b64 = signature.digest().encode('base64').rstrip('\n')
request.headers.update({
'BB-ACCESS-SIGN': signature_b64,
'BB-ACCESS-TIMESTAMP': timestamp,
'BB-ACCESS-KEY': self.api_key,
'Content-Type': 'application/json'
})
return request
api_url = 'https://shivex.io/api/'
auth = shivexexchangeAuth(API_KEY, API_SECRET)
# Get accounts
r = requests.get(api_url + 'profile/me', auth=auth)
print r.json()
The API base endpoint: https://shivex.io/api/
Endpoint: https://shivex.io/api/profile/me
Method: GET
Returns the currently logged profile data
The returning data fields: user_id, first_name, last_name, username, email, phone, language, country, city, bio, verified(1/0), created (YYYY-mm-dd), moderator, chat_status
Example:
{"success":true,"response":{"id":"4004","user_id":"NJOR5E","first_name":"Eugeneus","last_name":"","username":null,"email":"parserok24@gmail.com","phone":"380637312675","language":"english","country":null,"city":null,"address":null,"bio":"","verified":"0","created":"2021-08-26 13:12:45","moderator":null,"chat_status":"1"}}
Endpoint: https://shivex.io/api/profile/edit
Method: PUT
Update the currently logged profile with new data
The user data fields available to update:
first_name, last_name, username, email, phone, language, country, city, address, bio
The example of request body::
{"first_name":"Test First Name","last_name":"Test Last Name","username":"Test Username"}
The returning data: success = true/false and error list if exists
Possible errors: No user field listed
Endpoint: https://shivex.io/api/profile/verify
Method: POST
Verify profile with following data:
The returning data: success = true/false and error list if exists:
Possible errors: