Last active
March 16, 2021 14:42
-
-
Save jpadilla/b086af18f65d8f6f6800049957c32686 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.client | |
conn = http.client.HTTPSConnection("https://YOUR_DOMAIN") | |
payload = "{ \"roles\": [ \"ROLE_ID\", \"ROLE_ID\" ] }" | |
headers = { | |
'authorization': "Bearer MGMT_API_ACCESS_TOKEN", | |
'cache-control': "no-cache", | |
'content-type': "application/json" | |
} | |
conn.request("POST", "/api/v2/users/USER_ID/roles", payload, headers) | |
res = conn.getresponse() | |
data = res.read() | |
print(data.decode("utf-8")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.client | |
conn = http.client.HTTPSConnection("https://YOUR_DOMAIN") | |
headers = { 'authorization': "Bearer YOUR_MGMT_API_ACCESS_TOKEN" } | |
conn.request("GET", "/api/v2/users?q=name%3A%22jane%20smith%22&search_engine=v3", headers=headers) | |
res = conn.getresponse() | |
data = res.read() | |
print(data.decode("utf-8")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.client | |
conn = http.client.HTTPSConnection("https://YOUR_DOMAIN") | |
headers = { 'authorization': "Bearer YOUR_MGMT_API_ACCESS_TOKEN" } | |
conn.request("GET", "/api/v2/users?q=logins_count%3A%7B100%20TO%20*%5D&search_engine=v3", headers=headers) | |
res = conn.getresponse() | |
data = res.read() | |
print(data.decode("utf-8")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.client | |
conn = http.client.HTTPSConnection("https://YOUR_DOMAIN") | |
headers = { 'authorization': "Bearer YOUR_MGMT_API_ACCESS_TOKEN" } | |
conn.request("GET", "/api/v2/users?q=name%3Ajohn*&search_engine=v3", headers=headers) | |
res = conn.getresponse() | |
data = res.read() | |
print(data.decode("utf-8")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment