API
  • 18 Oct 2020
  • 2 Minutes To Read
  • Print
  • Share
  • Dark
    Light

API

  • Print
  • Share
  • Dark
    Light

Info

SaaS customers on SecureCircle Server versions 2.10.x or lower, please submit a support ticket to request the API key.

All actions in the SecureCircle server web administration interface are available via the REST API.

Documentation

Swagger documentation for the administrative API is available at https://SERVER/api/swagger-ui.html.

Retrieving an API key

Administrative users can obtain their API key from the user Settings window:

  • Each admin can obtain their API key via the web UI. In the top right of the interface, click on the user account menu and click settings.
  • The API will mirror the same permissions as the admin user.

Get Circles API Script

Python Example

def sc_get_circles(sc_server, apikey, scfrom=0, limit=100, orderBy="name-ASC", searchBy="(name LIKE '')"):
 
    circle_filter = {"from":scfrom,"limit":limit,"orderBy":orderBy,"searchBy":searchBy}
    headers = {'Api-Key':apikey}
    url = 'https://'+sc_server+"/api/v2/circles/get"
    data = json.dumps(circle_filter).encode('utf8')
    req = urllib.request.Request(url,data=data)
    req.add_header('Api-Key',apikey )
    req.add_header('User-agent' , 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5')
    req.add_header('Content-Type','application/json')
    req.add_header('Accept','application/json')
    with urllib.request.urlopen(req) as response:
        the_page = response.read()
    return  json.loads(the_page.decode())
# to get a filtered list of circles with 'george' in the name limited to 100 results. Filter is not case sensitive.
rr = sc_get_circles("your_server.securecircle.com","APIKEY", searchBy="(name LIKE 'george')")
 
# to get the first 10 circles unfiltered.
rr = sc_get_circles("your_server.securecircle.com","APIKEY",limit=10)
 
# in the event the full list of circles is too large you may have to start where previous search left off.
rr = sc_get_circles("your_.securecircle.io","APIKEY",limit=10,scfrom=10) #starts at 0 so 10 is the next record
 
# function returns a dictionary. to see the circle ID's something like the following would give you a list. change 'itemId' to 'name' to see names
for circle in rr["items"]:
    print('circle name:{} circle id:{}'.format(circle["name"], circle["itemId"]))

Parameters (other than server and apikey) are optional. If you want to override the defaults add which ever option you wish to override to the arguments.

searchBy filter has a format "(( LIKE '<value') OR ( EQ '))".

It supports AND, OR, EQ and LIKE

  • example: ((name LIKE 'george') OR (itemId EQ '{ccp-f033d9a5-11c0-4d4c-8843-3a9febs4493c}')) will return all circles with 'george' in the name and the specific circle by circle-id.

Invite User API Script

Python Example
def sc_invite_usr_to_circles(sc_server,circle,email,name,message,permissions,apikey):
    headers = {'Api-Key':apikey}
    invite = {}
    invite["circles"] = []
    circles = circle.split(",")
    for i in circles:
        circle_info = {"itemId": i,"permissions": permissions}
        invite["circles"].append(circle_info)
    invite["email"] = email
    invite["name"] = name
    invite["message"] = message
    url = 'https://'+sc_server+"/api/v2/members/invite"
    array = [invite]
    data = json.dumps(array).encode('utf8')
    req = urllib.request.Request(url,data=data)
    req.add_header('Api-Key',apikey )
    req.add_header('User-agent' , 'Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5')
    req.add_header('Content-Type','application/json')
    req.add_header('Accept','application/json')
    with urllib.request.urlopen(req) as response:
        the_page = response.read()
    return json.loads(the_page.decode())
rr = sc_invite_usr_to_circles("your_server.securecircle.com","{69467695-9c46-11e9-9a7e-938038b1d15a}","your_email@your_company.com","name of person","just a invite message",0,"apikey")

Permissions:
0 = can not add files to circle
1 = can add files to circle (right click)

Was This Article Helpful?