A
anu31221@gmail.com
Guest
Whats the difference between using setDataField and setBinaryField and setBinaryData My objective is to upload different type(PDF or DOC) of document to a field in object. I have been trying to use setBinaryData and not working. Which API should be use Thank a lot for help Anu On Fri, May 2, 2014 at 2:03 PM, Laurent bounce-lpoulain@community.progress.com wrote: RE: Attachment not working for REST API call. Reply by Laurent Here's my code, written in Python 3.x. Note that you need to change the id and fieldName values in the URL: import requests, sys, getpass, base64 import xml.etree.ElementTree as ET # Step 1: Login base_url = ' https://www.rollbase.com/rest/api/ ' login = input("Rollbase login: ") pw = getpass.getpass() url = base_url + 'login?loginName=' + login + '&password=' + pw r = requests.get(url) tree = ET.fromstring(r.content) session_id = tree[0].text print('Session ID: ' + session_id) # Step 2: call setDataField() url = base_url + 'setDataField?sessionId=' + session_id + \ '&id=967518&fieldName=myFieldName&contentType=application/pdf&fileName=test.pdf' files = { 'value': base64.b64encode(open('myfile.pdf', 'rb').read()) } r = requests.post(url, data=files) print(r.content) Stop receiving emails on this subject. Flag this post as spam/abuse.
Continue reading...
Continue reading...