You can use the API tokenization feature in the Armor Management Portal (AMP) to create an API key. This key will help you log into the Armor API system.
Step 1: Create an API key
Insert excerpt ESLP:Create an API (snippet) ESLP:Create an API (snippet) nopanel true
Step 2: Authenticate into the Armor API system
To authenticate, you need to build a header with the following components:
...
Code Block | ||
---|---|---|
| ||
def _post_requests_apiKey_payload(self, path="/example/anywhere", body = ): app_id = "<api_key_id>" secret_key = "<secret_key>" request_path = urlparse(path).path http_method = "POST" timestamp = int(time.time()) nonce = uuid.uuid4() hash_obj = hashlib.sha512(bytes(json.dumps(body), 'utf-8')) request_body = base64.standard_b64encode(hash_obj.digest()) content = (app_id, http_method, request_path, str(nonce), str(timestamp), request_body.decode()) request_data = ''.join(content) mc = hmac.new(bytes(secret_key, 'utf-8'), bytes(request_data, 'utf-8'), hashlib.sha512) signature = base64.standard_b64encode(mc.digest()) auth_header = "ARMOR-PSK " + str(app_id) + ':' + str(signature.decode('utf-8')) + ':' + str( nonce) + ':' + str(timestamp) request_header = { 'Content-Type': 'application/json', "Authorization": auth_header } response = requests.post(self._url(path), data=json.dumps(body), headers=request_header) print (response.status_code) return response |
Step 3: Make an API Call
To learn about the different calls that you can make, see Armor API Guide.
Related Documentation
- To learn about the different calls that you can make, see Armor API Guide.
- To learn how to create an API key or to learn a different way to access the Armor API system, see Log into the Armor APIPre-Shared Key Authentication Method - Legacy.