|
| 1 | +# Harmony Endpoint Management API |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | + |
| 5 | +- clientId |
| 6 | +- accessKey |
| 7 | + |
| 8 | +## Authentication |
| 9 | + |
| 10 | +- The nature of authentication for this app requires you to get 2 token keys to be used for authentication of future requests. |
| 11 | +- For the app in shuffle there will be 2 fields that you need to setup inorder for you to be able to authenticate and utilize the app in Shuffle |
| 12 | + |
| 13 | + |
| 14 | +1. API Key parameter |
| 15 | + - In the API key parameter you will paste in the following python script. Providing your clientID and accessKey as well. |
| 16 | + |
| 17 | +``` |
| 18 | +{% python %} |
| 19 | +import requests |
| 20 | +import json |
| 21 | +
|
| 22 | +url = "https://cloudinfra-gw.portal.checkpoint.com/auth/external" |
| 23 | +
|
| 24 | +
|
| 25 | +payload = { |
| 26 | + "clientId": "", |
| 27 | + "accessKey": "" |
| 28 | +} |
| 29 | +
|
| 30 | +
|
| 31 | +headers = { |
| 32 | + "Content-Type": "application/json" |
| 33 | +} |
| 34 | +
|
| 35 | +response = requests.post(url, headers=headers, data=json.dumps(payload)) |
| 36 | +
|
| 37 | +print(response.json()["data"]["token"]) |
| 38 | +
|
| 39 | +{% endpython %} |
| 40 | +``` |
| 41 | +2. x-mgmt-api-token parameter |
| 42 | + - In the x-mgmt-api-token parameter paste in the following python script. |
| 43 | + |
| 44 | +``` |
| 45 | +{% python %} |
| 46 | +import requests |
| 47 | +import json |
| 48 | +
|
| 49 | +url = "https://cloudinfra-gw.portal.checkpoint.com/auth/external" |
| 50 | +payload = { |
| 51 | + "clientId": "", |
| 52 | + "accessKey": "" |
| 53 | +} |
| 54 | +
|
| 55 | +
|
| 56 | +headers = { |
| 57 | + "Content-Type": "application/json" |
| 58 | +} |
| 59 | +
|
| 60 | +response = requests.post(url, headers=headers, data=json.dumps(payload)) |
| 61 | +#print(response.text) |
| 62 | +
|
| 63 | +data = response.json() |
| 64 | +token = data["data"]["token"] |
| 65 | +
|
| 66 | +#print(token) |
| 67 | +
|
| 68 | +second_url = "https://cloudinfra-gw.portal.checkpoint.com/app/endpoint-web-mgmt/harmony/endpoint/api/v1/session/login/cloud" |
| 69 | +headers = { |
| 70 | + "Authorization": "Bearer %s" % token, |
| 71 | + "Content-type": "application/json", |
| 72 | + "Accept": "application/json" |
| 73 | +
|
| 74 | +} |
| 75 | +response = requests.post(second_url, headers=headers) |
| 76 | +print(response.json()["apiToken"]) |
| 77 | +{% endpython %} |
| 78 | +``` |
| 79 | +- Once this is done you should be able to make subsequent requests seamlessly with your saved and encrypted authentication. |
| 80 | + |
| 81 | + ## NOTE: |
| 82 | + - You will need to provide appropriate headers where necessary i.e |
| 83 | + Content-Type=application/json |
| 84 | + Accept=application/json |
| 85 | + x-mgmt-run-as-job: on |
| 86 | + - Remember to provide the appropriate CLIENTID and ACCESSKEY where required in the provided python scripts. |
0 commit comments