Request used to get account details for a specified account
-
URL
-
Method:
GET
-
Authentication:
Owner key is required.
-
URL Params
accountid=[UUID]
Example Value: de305d54-75b4-431b-adb2-eb6b9e546014
-
Data Params
None
-
Success Response:
-
Code: 200
Content:{ "id": "0d9dcbd3-11a8-49f4-a028-dfa46d71de5a", "email": "[email protected]", "name": "Foo Bar", "organization": "Foo Bar INC", "max_retention_period": 100000, "retention_period": 100000, "owner_api_key_id": "bebb6a4a-62f8-48f2-b10a-b48792e77a87", "rw_api_key": "8df0c98b-73cc-4a2f-8cfe-c55e7971e3e3" "ro_api_key": "858595c4-715f-4ac8-8cdd-bbd86084adc9", }
-
-
Error Response:
If a request other then GET is made.
- Code: 405 UNAUTHORIZED
If the Account ID can not be found or signatures do not match
- Code: 404 NOT FOUND
- Code: 405 UNAUTHORIZED
-
Sample Call:
import base64 import datetime import hashlib import hmac import requests resource_id = "<your_resource_id>" api_key_id = "<your_api_key_id>" api_key = "<your_api_key>" uri = 'management/accounts/%s' % resource_id def gensignature(api_key, date, content_type, request_method, query_path, request_body): encoded_hashed_body = base64.b64encode(hashlib.sha256(request_body).digest()) canonical_string = request_method + content_type + date + query_path + encoded_hashed_body # Create a new hmac digester with the api key as the signing key and sha1 as the algorithm digest = hmac.new(api_key, digestmod=hashlib.sha1) digest.update(canonical_string) return digest.digest() def create_headers(): date_h = datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT") content_type_h = "application/json" method = 'GET' action = uri signature = gensignature(api_key, date_h, content_type_h, method, action, '') headers = { "Date": date_h, "Content-Type": content_type_h, "authorization-api-key": "%s:%s" % (api_key_id.encode('utf8'), base64.b64encode(signature)) } print headers return headers headers = create_headers() def get_account(): url = "https://rest.logentries.com/" + uri print url r = requests.request('GET', url, headers=headers) print r.status_code, r.content def start(): get_account() if __name__ == '__main__': start()
-
Notes: