Python

Login

import requests
import json
def send_request():
try:
response = requests.post(
url="https://api.configtree.co/v1/login/",
headers={
"Content-Type": "application/json",
},
data=json.dumps({
"email": "johnny@example.com",
"organizationSlug": "example",
"password": "securePassword"
})
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')

Refresh Login

import requests
import json
def send_request():
try:
response = requests.post(
url="https://api.configtree.co/v1/login/refresh/",
headers={
"Content-Type": "application/json",
},
data=json.dumps({
"refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU1NDUwOTIxNiwianRpIjoiYmYxNjMwZGIyYjhkNGU1MjkxNDUzZTU2MTZhYTBjZmQiLCJ1c2VyX2lkIjoiY2RiZjQyMDktMGU5NC00N2YyLTlhYmEtYTQ5OGY5N2JjMzQ2In0.ddRkA_NO5O99m16Vj675Icgo8Bq_mIaWtrAEkSnQ7nM"
})
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')

Get Live Version

import requests
def send_request():
try:
response = requests.get(
url="https://api.configtree.co/v1/example/versions/",
params={
"applicationName": "EmailService",
"environmentName": "Testing",
},
headers={
"Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTU0NDE5ODI1LCJqdGkiOiIyZjYxNmI3MTMyNjY0N2JhYWNlODRjNmI5OTljMWJiYiIsInVzZXJfaWQiOiJjZGJmNDIwOS0wZTk0LTQ3ZjItOWFiYS1hNDk4Zjk3YmMzNDYifQ.0QT3Piz1Y5dQ78d9vCi8WGmIsY0-sVXPmT9FbiMjFhs",
},
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')