7 Replies Latest reply on Oct 8, 2014 5:38 AM by thales

    Trying to get group members via Python Rest API - HTTP Status Code 400

    thales

      I am trying to get a list of group members using the Rest API and Python, but I am getting a HTTP status code of 400 and US 8B BS. Not sure what I am missing.

       

      Ultimately I'd like to be able to take the list and remove all members from the group.

       

      Any help would be appreciated.

       

      Thanks,

      Timothy

       

       

      #Get group members.
      import urllib2, json, base64
      
      placeID = "1061"
      
      uri = "/api/core/v3/members/places/{}".format(placeID)
      base_url = "https://community.com"
      url = base_url + uri
      
      user = "UserName"
      password = "password"
      
      auth = "Basic " + base64.encodestring('%s:%s' % (user, password)).replace("\n","");
      
      headers = { "Content-Type": "application/json", "Authorization": auth }
      
      req = urllib2.Request(url=url, headers=headers )
      
      try:
      jsonReq = urllib2.urlopen(req)
      # print jsonReq.text
      except urllib2.HTTPError, e:
      print e.code
      print e.read()