Python API - 401 - 'Auth scheme not supported - AnaplanCertificate'
Hi all,
I tried to use the certificate authentication method with the Python API. I used one of the many Python scripts provided but I get a 401 Response : 'Auth scheme not supported - AnaplanCertificate'.
Do you know if it is required to enable the Anaplan certificate authentication method somewhere in order to use it ?
Thank you very much for your help,
Joël
# This script returns the metadata for each chunk in a file to a json array
# saved in file 'chunkData.json'.
# This script assumes you know the workspaceGuid, modelGuid, and fileID for the
# file you want to check. If you do not know this information, please run
# 'getWorkspaces.py', 'getModels.py', and 'getFiles.py' respectively.
# If you are using certificate authentication, this script assumes you have
# converted your Anaplan certificate to PEM format, and that you know the
# Anaplan account email associated with that certificate.
# This script uses Python 3 and assumes that you have the following modules
# installed: requests, base64
import requests
import base64
# Insert your workspace Guid
wGuid = ''
# Insert your model Guid
mGuid = ''
# Insert your file ID
fileID = ''
# Insert the Anaplan account email being used
username = ''
# If using cert auth, replace cert.pem with your pem converted certificate
# filename. Otherwise, remove this line.
cert = open('cert.pem').read()
# If using basic auth, insert your password. Otherwise, remove this line.
password = ''
# Uncomment your authentication method (cert or basic). Remove the other.
user = 'AnaplanCertificate ' + str(base64.b64encode((
f'{username}:{cert}').encode('utf-8')).decode('utf-8'))
# user = 'Basic ' + str(base64.b64encode((f'{username}:{password}'
# ).encode('utf-8')).decode('utf-8'))
getHeaders = {
'Authorization': user
}
getChunkData = requests.get('https://api.anaplan.com/1/3/workspaces/' +
f'{wGuid}/models/{mGuid}/files/{fileID}' +
'/chunks',
headers=getHeaders)
with open('chunkData.json', 'wb') as f:
f.write(getChunkData.text.encode('utf-8'))
Tagged:
0
Comments
-
This code us calling the API v1.3 code. Certificates of any type are not supported on that version. To use CA certificates you need to use API v2.0
It uses a Authentication API: https://anaplanauthentication.docs.apiary.io/#
And the integration API: https://anaplanbulkapi20.docs.apiary.io/#
Scott
0
Categories
- All Categories
- 2.3K Anaplan Community
- Academy
- Anaplan Talent Builder
- Model Design Course
- The Anaplan Way
- Archive
- 2 Idea exchange
- 62 Enterprise Scale
- 1.1K Extensibility
- 21 Intelligence
- 1.6K Planning & Modeling
- 331 Security
- Community Connections
- Connections
- Experiences
- Groups
- Personas
- Employees
- CS Toolkit
- Customer Care Center
- Forums
- Academy & Training
- Community Feedback & Updates
- Japan
- Anaplan Community Japan
- Anaplan Community Japan Knowledge Base
- HyperCare Japan
- JP-Central
- Support-Japanese
- Partners
- Partner Leadership Council
- Partner Product Council
- 724 Platform
- Anapedia
- App Hub
- Centers Of Excellence
- Extensions
- Planual
- Platform Updates
- 724 User Experience
- Profile Builder
- Resources
- Anaplan Advocates
- Anaplan Live!
- Community
- Community Advancement
- Community Connections
- Partner Program
- The Official Master Anaplanner Program
- Videos
- Welcome to the Anaplan Community!
- Success Central
- Support
- Case Portal Link
- Common Support Questions
- HyperCare Redirect
- Known Issues and Workarounds
- Support test page
- SupportFAQ
- Survey
- 2 Training Day Takeaways