def performGenericPost(connection, listUrl, payloadDict): ''' This will perform a generic POST method on a given url Args: - connection is the connection object that manages the HTTP data transfers between the client and the REST API - url is the address of where the operation will be performed - payloadDict is the python dict with the parameters for the operation ''' data = json.dumps(payloadDict) reply = connection.httpPost(url=listUrl, data=data) if not reply.ok: raise Exception(reply.text) try: newObjPath = reply.headers['location'] except: raise Exception("Location header is not present. Please check if the action was created successfully.") newObjID = newObjPath.split('/')[-1] return newObjID