Skip to content

Commit ab149a0

Browse files
committed
client id -> api project id
1 parent 84826ba commit ab149a0

10 files changed

+24
-24
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ This is one of
3030

3131
Make sure to save the file.
3232

33-
### `client_id.txt`
33+
### `api_project_id.txt`
3434

35-
In the downloaded `cloud-api-example-code` folder, open `client_id.txt`.
35+
In the downloaded `cloud-api-example-code` folder, open `api_project_id.txt`.
3636

3737
Populate this file with your application ID from Alteryx Analytics Cloud.
3838

@@ -42,9 +42,9 @@ Populate this file with your application ID from Alteryx Analytics Cloud.
4242

4343
1. You should see your new project in the list of projects. ![Project listing](images/listOfProjects.png)
4444

45-
1. Click on the project and copy the Client ID to your clipboard. ![Copying Client ID](images/copyingClientId.png)
45+
1. Click on the project and copy the API Project ID to your clipboard. ![Copying API Project ID](images/copyingApiProjectId.png)
4646

47-
1. Open the `client_id.txt` file in this repository, and paste in the copied Client ID. Be sure to save the file. ![Client ID file](images/clientIdFile.png)
47+
1. Open the `api_project_id.txt` file in this repository, and paste in the copied API Project ID. Be sure to save the file. ![API Project ID file](images/apiProjectIdFile.png)
4848

4949
### `creds.json`
5050

@@ -161,7 +161,7 @@ The expected output looks like:
161161
}
162162
```
163163

164-
Ensure that your client ID in `client_id.txt` is present and correct. See instructions above.
164+
Ensure that your API Project ID in `api_project_id.txt` is present and correct. See instructions above.
165165

166166
### `rllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>`
167167

api_project_id.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Your api project id here

client_id.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

get_workspace.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import fs from 'fs/promises';
44
* This program prints the current workspace using credentials stored in files
55
*/
66

7-
const clientIdFile = 'client_id.txt';
7+
const apiProjectIdFile = 'api_project_id.txt';
88
const credsFile = 'creds.json'
99
const aacURLFile = 'aac_url.txt'
1010

1111
async function main() {
1212
const accessToken = await getAccessToken();
13-
const clientId = (await fs.readFile(clientIdFile)).toString().trim();
13+
const apiProjectId = (await fs.readFile(apiProjectIdFile)).toString().trim();
1414
const aacURL = (await fs.readFile(aacURLFile)).toString().trim();
15-
console.log(await getCurrentWorkspace(aacURL, accessToken, clientId));
15+
console.log(await getCurrentWorkspace(aacURL, accessToken, apiProjectId));
1616
}
1717

1818
main();
@@ -58,12 +58,12 @@ async function getAccessToken() {
5858
/**
5959
* Gets the current workspace, and returns it as an object
6060
*/
61-
async function getCurrentWorkspace(aacURL, accessToken, clientId) {
61+
async function getCurrentWorkspace(aacURL, accessToken, apiProjectId) {
6262

6363
// These headers are necessary in every request to the AAC API
6464
const headers = {
6565
'Authorization': `Bearer ${accessToken}`,
66-
'x-client-id': clientId,
66+
'x-api-project-id': apiProjectId,
6767
'User-Agent': 'myApp', // Describe your application here
6868
}
6969

get_workspace.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88
"""
99

1010
"""
11-
Get a new Client ID here: https://us1.alteryxcloud.com/cloud-portal/library/alteryx-io
11+
Get a new Api Project ID here: https://us1.alteryxcloud.com/cloud-portal/library/alteryx-io
1212
This uniquely identifies your application
1313
"""
14-
client_id_file = 'client_id.txt'
14+
api_project_id_file = 'api_project_id.txt'
1515
creds_file = 'creds.json'
1616
aac_url_file = 'aac_url.txt'
1717

1818
def main():
19-
with open(client_id_file) as f:
20-
client_id = f.read().rstrip()
19+
with open(api_project_id_file) as f:
20+
api_project_id = f.read().rstrip()
2121
access_token = get_access_token()
2222
with open(aac_url_file) as f:
2323
aac_url = f.read().rstrip()
24-
print(get_current_workspace(aac_url, access_token, client_id))
24+
print(get_current_workspace(aac_url, access_token, api_project_id))
2525

2626
def get_access_token():
2727
"""
@@ -62,15 +62,15 @@ def get_access_token():
6262

6363
return new_creds['access_token']
6464

65-
def get_current_workspace(aac_url, access_token, client_id):
65+
def get_current_workspace(aac_url, access_token, api_project_id):
6666
"""
67-
Given an access token and client id,
67+
Given an access token and api project id,
6868
Gets the current workspace, and returns it as an object
6969
"""
7070
# These headers are necessary in every request to the AAC API
7171
headers = {
7272
'Authorization': f'Bearer {access_token}',
73-
'x-client-id': client_id,
73+
'x-api-project-id': api_project_id,
7474
'User-Agent': 'my_app', # Descirbe your application here
7575
}
7676

get_workspace.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
# Requirements: jq, curl
66

7-
client_id_file="client_id.txt"
7+
api_project_id_file="api_project_id.txt"
88
creds_file="creds.json"
99
aac_url_file="aac_url.txt"
1010

1111
# Main function
1212
main() {
13-
client_id=$(cat $client_id_file | xargs)
13+
api_project_id=$(cat $api_project_id_file | xargs)
1414
access_token=$(get_access_token)
1515
aac_url=$(cat $aac_url_file | xargs)
16-
echo $(get_current_workspace "$access_token" "$client_id" "$aac_url")
16+
echo $(get_current_workspace "$access_token" "$api_project_id" "$aac_url")
1717
}
1818

1919
# Function to get the access token (with refresh logic)
@@ -49,13 +49,13 @@ get_access_token() {
4949
get_current_workspace() {
5050

5151
access_token="$1"
52-
client_id="$2"
52+
api_project_id="$2"
5353
aac_url="$3"
5454

5555
# Make the request to get the current workspace using curl
5656
response=$(curl -s -X GET "$aac_url/iam/v1/workspaces/current" \
5757
-H "Authorization: Bearer $access_token" \
58-
-H "x-client-id: $client_id" \
58+
-H "x-api-project-id: $api_project_id" \
5959
-H "User-Agent: myApp") # Describe your application here
6060

6161
# Output the response (current workspace)

images/apiProjectIdFile.png

29.3 KB
Loading

images/clientIdFile.png

-25.8 KB
Binary file not shown.

images/copyingApiProjectid.png

555 KB
Loading

images/copyingClientId.png

-660 KB
Binary file not shown.

0 commit comments

Comments
 (0)