Python example - UserService1.svc/GetEnabledUsers

import sys, json, requests

 

companyKey = 'companyKey' # Replace the Company Key

 

headers = {'content-type':'application/json','X-Replicon-Application':'TestCompanykey_ProjectImport_1.0', 'Authorization': 'Bearer lXluv1eGYEGzMwjpsRL5mgEANTNkYTAyZWM5OWU2NDg2MWFmZWVjZDM3MzAxZjA1NTA'}

 

# Finding Swimlane

swimlaneFinderUrl = 'https://global.replicon.com/DiscoveryService1.svc/GetTenantEndpointDetails'

swimlaneFinderJsonBody = {}

tenant = {}

tenant['companyKey'] = companyKey

swimlaneFinderJsonBody['tenant'] = tenant

 

swimlaneInfo = None

 

# Getting the Swimlane information of the Company Key

try:

 

                swimlaneFinder = requests.post(swimlaneFinderUrl, headers = headers, data = json.dumps(swimlaneFinderJsonBody))

                swimlaneFinder = swimlaneFinder.json()

 

                if swimlaneFinder.get('error'):

 

                                print 'Error: {0}'.format(swimlaneFinder.get('error'))

 

                                sys.exit(1)

 

                else:

 

                                swimlane = swimlaneFinder['d']['applicationRootUrl']

 

except Exception, e:

 

                                print 'Error: {0}'.format(e)

 

                                sys.exit(1)

 

# Getting All enabled Users in the tenant.

try:

 

                allEnabledUserUrl = swimlane + 'services/UserService1.svc/GetEnabledUsers'

 

                allEnabledUser = requests.post(allEnabledUserUrl, headers = headers)

                allEnabledUser = allEnabledUser.json()

 

                if allEnabledUser.get('error'):

 

                                print 'Error: {0}'.format(allEnabledUser.get('error'))

 

                                sys.exit(1)

 

                else:

 

                                for user in allEnabledUser['d']:

 

                                                print user

 

except Exception, e:

 

                print 'Error: {0}'.format

 

                sys.exit(1)

Want all the latest industry updates, news on Replicon products and tips to better manage projects and time?

Sign up for our newsletter today and be the first to know!

Start a free Replicon trial today based on your business needs

Start Free Trial

Start a free Replicon trial today based on your business needs

Start Free Trial