-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Morning,
I was trying to use the activity_log API endpoint to create a activity record:
cerb.create_record('activity_log',fields={'activity_point':'custom.other','actor__context':'worker','actor_id':'11','created':int(time.time()),'target__context':'contact','target_id':'4669','params':{'message':'I am a message'}})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sean/.local/lib/python3.8/site-packages/cerbapi/__init__.py", line 138, in create_record
return self.send('POST', 'records/{}/create'.format(uri),
File "/home/sean/.local/lib/python3.8/site-packages/cerbapi/__init__.py", line 50, in send
raise CerbException(response['message'])
cerbapi.CerbException: must be an object.
Based on the guidelines here: https://cerb.ai/docs/api/records/activity-log/
The object params is required to write the message but I could not find an accepted variant that would allow a successful request. It seems the library is clobbering the nested object and Cerb rejects it.
As a workaround (thanks Jeff @cerb), one should use cerb.send and manually craft the post request.
Thanks,
Sean
Metadata
Metadata
Assignees
Labels
No labels