python-2.7jive

Post list contents to jive connect page using python


I am trying to upload a list of user names to Jive content page But I am getting 405 every time I try. Below is the sample code I am trying to use to post some contents to page

url = "https://connect.**.***.com/api/core/v3/contents?filter=entityDescriptor(102,786664)"
header = { "Content-Type": "application/json" }
username='*******'
passwd='******'
r = requests.put(url, headers=header,auth=(username,passwd),json=list_of_delegatedadmins, verify=False)
print r.content, r

Can someone please help me. I tried with format https://connect.**.***.com/api/core/v3/contents/contentid but now the response is 400.


Solution

  • I found out the answer for the issue. The content ID needs to be posted is not the document id(786664). Before posting need to get the contents using GET. From the response extract the ID "entityType" : "document", "id" : "786664", "resources" : { "entitlements" : { "allowed" : [ "GET" ], "ref" : "https://connect.**.***.com/api/core/v3/contents/1943462/entitlements" },

    1943462 is the content ID to be passed in request URL will be :

    "url = "https://connect.**.***.com/api/core/v3/contents/1943462?minor=true" minor = true makes sure no notification or mails updates to users with this change