Post

3 followers Follow
1
Avatar

API Login - Not Supported on Current Edition

I'm looking to get started on utilizing the Clarizen REST API. From the documentation: 
"REST API is provided for Clarizen V6 and on. To use the REST API your organization must use Enterprise Edition." I've been informed that we have the enterprise edition; when attempting to login:

>>> response 
<Response [401]>

>>> response.text 
'{"errorCode":"LoginFailure","message":"API access is not supported in your current edition","referenceId":"35cWsns1MdQ65db1IfhPdx"}'

Joe Teumer Answered

Official comment

Avatar

Hi Joe,

Can you please open a support ticket so we can handle this issue?

 

Thanks,

Elad

Elad Franklin
Comment actions Permalink

Please sign in to leave a comment.

8 comments

0
Avatar

import json
import requests
import sys
import getpass

clarizen_rest_api_url = 'https://api.clarizen.com/v2.0/services/'
login_url = 'authentication/login'
query_url = 'data/EntityQuery'
create_and_retrieve_url = 'data/createAndRetrieve'

clarizen_user_name = 'joe.teumer@mbx.com'
clarizen_password = getpass.getpass()
session_id = ''


def login():
data = {'userName': clarizen_user_name, 'password': clarizen_password}
url = clarizen_rest_api_url + login_url
response = requests.post(url, data)

# todo debug
print(response.text)
sys.stdout.flush()

response_data = json.loads(response.text)
global session_id
session_id = response_data['sessionId']

sys.exit(1)


def query(data=None):
headers = {'Authorization': 'Session ' + session_id}
url = clarizen_rest_api_url + query_url
response = requests.post(url, data=json.dumps(data), headers=headers)
json_response = json.loads(response.content)
return json_response.get('entities')


def create(data=None):
headers = {'Authorization': 'Session ' + session_id}
url = clarizen_rest_api_url + create_and_retrieve_url
response = requests.post(url, data=json.dumps(data), headers=headers)
json_response = json.loads(response.content)
return json_response.get('entity')


def retrieve_projects():
data = {'typeName': 'Project', 'fields': ['Name', 'StartDate']}
results = query(data)
return results


def create_project(name):
data = {'entity': {'Id': '/Project', 'Name': name, 'StartDate': '2017-6-16',}, 'fields': ['Name', 'DueDate']}
results = create(data)
return results


login()
create_results = create_project('My Project A')
query_results = retrieve_projects()

 

→ python3 clarizen.py
Password:
{"errorCode":"LoginFailure","message":"API access is not supported in your current edition","referenceId":"36pN503tQxj79lX3XzhPrz"}
Traceback (most recent call last):
File "clarizen.py", line 60, in <module>
login()
File "clarizen.py", line 27, in login
session_id = response_data['sessionId']
KeyError: 'sessionId'

Joe Teumer 0 votes
Comment actions Permalink
0
Avatar

Changing my account type to basic admin allows me to use the API.

Joe Teumer 0 votes
Comment actions Permalink
0
Avatar

What was your account type before?  Admin rights is indeed needed to use the API.

Josh Santos 0 votes
Comment actions Permalink