Programmatically using Block 64 API with client ID and token
Block 64 API will allow you to programmatically access Combine data and features.
Prerequisites
Generate client id and secret
- Navigate to "Users" and click edit icon in order to open the "Edit User" view
- Press on the "Reload Token" button under Token Management. A toast with client id and secret will appear as shown in the image below
- Copy client id and secret into your application. In this example I'll be using curl
Retrieve the customer id
- Navigate to "Customers" and client edit icon in order to open the "Edit Customer" view
- Copy the "Customer GUID" from the view
Sample CURL request and response
Authorize request
curl --location --request POST 'https://api.block64.com/api/v1/auth/authorize' \ --form 'client_id="a2264f899a38dca762f818bd47dbeb1676f956088ade1799cfc64a5ccdecaab8"' \ --form 'client_secret="c0cb25446703c6c9ac3e1fd3dee0964130d63c5b007a69fd7821f59152fd0d2e8bb1302dcc272da3fc7db86dacec9f4777a8f9e9adf2a2d7bcccecd69f521a81"' \ --form 'customer_guid="42c19cf5-2a76-47e8-80d4-94afb19f0f9f"'curl --location --request POST 'https://api.block64.com/api/v1/auth/authorize' \--form 'client_id="a2264f899a38dca762f818bd47dbeb1676f956088ade1799cfc64a5ccdecaab8"' \--form 'client_secret="c0cb25446703c6c9ac3e1fd3dee0964130d63c5b007a69fd7821f59152fd0d2e8bb1302dcc272da3fc7db86dacec9f4777a8f9e9adf2a2d7bcccecd69f521a81"' \--form 'customer_guid="42c19cf5-2a76-47e8-80d4-94afb19f0f9f"'
Authorize response
{ "expire_time": 3600,"region_url": "https://api-usa-east.block64.com/api/v1","token": "eyJhbGciOiJIUzUxKiIsImlhdCI6MTY0OTI1Njc4NCwiZXhwIjoxNjQ5MjYwMzg0fQ.eyJjbGllbnRfaWQiOiJhMjI2M2Y4OTlhMzhkY2E3NjJmODE4YmQ0N2RiZWIxNjc2Zjk1NjA4OGFkZTE3OTljZmM2NGE1Y2NkZWNhYWI4IiwidXNlcl9pZCI6MTAwMSwiY3VzdG8tZXJfZ3VpZCI6IjQ2YzE5Y2U1LTJkMzYtODdlOC04MGQ0LTk0YmZhMTlmMGY5ZiJ9.jGBER3jbbNdrK_D3-JjxR14dbEBJJwzbX3MXB2TaHN18zzjMrbg8I4QnwWPMDWpEyCi42qi9BdYNTQ8epWocEg" }"region_url": "https://api-usa-east.block64.com/api/v1",
Index fetch request
curl --location --request GET 'https://api.block64.com/api/v1/reports/index' \ --header 'Authorization: Bearer eyJhbGciOiJIUzUxKiIsImlhdCI6MTY0OTI1Njc4NCwiZXhwIjoxNjQ5MjYwMzg0fQ.eyJjbGllbnRfaWQiOiJhMjI2M2Y4OTlhMzhkY2E3NjJmODE4YmQ0N2RiZWIxNjc2Zjk1NjA4OGFkZTE3OTljZmM2NGE1Y2NkZWNhYWI4IiwidXNlcl9pZCI6MTAwMSwiY3VzdG8tZXJfZ3VpZCI6IjQ2YzE5Y2U1LTJkMzYtODdlOC04MGQ0LTk0YmZhMTlmMGY5ZiJ9.jGBER3jbbNdrK_D3-JjxR14dbEBJJwzbX3MXB2TaHN18zzjMrbg8I4QnwWPMDWpEyCi42qi9BdYNTQ8epWocEg'
Index fetch response
- This is the full list of available url to fetch data.
- DataURL (Regional url) should be used to make data fetch request
[ { "DataURL": "", "IsLeaf": false, "ItemKind": "Folder", "ItemName": "Folder", "Key": "discovery_reports", "Name": "Discovery Reports", "Parent": "" }, { "DataURL": "https://api-usa-east.block64.com/api/v1/reports/endpoints", "IsLeaf": true, "ItemKind": "Table", "ItemName": "Table", "Key": "endpoints", "Name": "Endpoints", "Parent": "discovery_reports" }, { "DataURL": "https://api-usa-east.block64.com/api/v1/reports/active_directory_users", "IsLeaf": true, "ItemKind": "Table", "ItemName": "Table", "Key": "active_directory_users", "Name": "Active Directory Users", "Parent": "discovery_reports" }, { "DataURL": "https://api-usa-east.block64.com/api/v1/reports/active_directory_devices", "IsLeaf": true, "ItemKind": "Table", "ItemName": "Table", "Key": "active_directory_devices", "Name": "Active Directory Devices", "Parent": "discovery_reports" } ][{"DataURL": "","IsLeaf": false,"ItemKind": "Folder","ItemName": "Folder","Key": "discovery_reports","Name": "Discovery Reports","Parent": ""},{"DataURL": "https://api-usa-east.block64.com/api/v1/reports/endpoints","IsLeaf": true,"ItemKind": "Table","ItemName": "Table","Key": "endpoints","Name": "Endpoints","Parent": "discovery_reports"},{"DataURL": "https://api-usa-east.block64.com/api/v1/reports/active_directory_users","IsLeaf": true,"ItemKind": "Table","ItemName": "Table","Key": "active_directory_users","Name": "Active Directory Users","Parent": "discovery_reports"},{"DataURL": "https://api-usa-east.block64.com/api/v1/reports/active_directory_devices","IsLeaf": true,"ItemKind": "Table","ItemName": "Table","Key": "active_directory_devices","Name": "Active Directory Devices","Parent": "discovery_reports"}]
Data fetch request
curl --location --request GET 'https://api-usa-east.block64.com/api/v1/reports/endpoints' \ --header 'Authorization: Bearer eyJhbGciOiJIUzUxKiIsImlhdCI6MTY0OTI1Njc4NCwiZXhwIjoxNjQ5MjYwMzg0fQ.eyJjbGllbnRfaWQiOiJhMjI2M2Y4OTlhMzhkY2E3NjJmODE4YmQ0N2RiZWIxNjc2Zjk1NjA4OGFkZTE3OTljZmM2NGE1Y2NkZWNhYWI4IiwidXNlcl9pZCI6MTAwMSwiY3VzdG8tZXJfZ3VpZCI6IjQ2YzE5Y2U1LTJkMzYtODdlOC04MGQ0LTk0YmZhMTlmMGY5ZiJ9.jGBER3jbbNdrK_D3-JjxR14dbEBJJwzbX3MXB2TaHN18zzjMrbg8I4QnwWPMDWpEyCi42qi9BdYNTQ8epWocEg'
Data fetch response
{ "count": 71, "limit": 100000, "next": null, "previous": null, "results": [ {"Description": "", "Domain": "", "LastInventory": 1657099951, "Manufacturer": "Manufacturer", "Model": "ABCDEFG" } ] }"Description": "","Domain": "","LastInventory": 1657099951,"Manufacturer": "Manufacturer","Model": "ABCDEFG"}]}