-
-
Save bwghughes/c98b52088c3733eed8f9c99581d2fc14 to your computer and use it in GitHub Desktop.
Problem with POST'ing BillExpenseItems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
import requests | |
import logging | |
logging.basicConfig(level=logging.INFO) | |
log = logging.getLogger(__name__) | |
url = "http://0ba03adb.ngrok.io/api.rsc/BillExpenseItems" | |
body = { | |
"ExpenseLineId": "21", | |
"ExpenseAccountId": "6001", | |
"ExpenseAmount": "10.00", | |
"VendorID": "800002CA-1464931068", | |
} | |
headers = {"Content-Type": "application/json", | |
"x-cdata-authtoken": os.getenv('CDATA_TOKEN')} | |
resp = requests.post(url, json.dumps(body), headers=headers) | |
log.info(resp.json()) | |
log.info(resp.status_code) | |
Returns: | |
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 0ba03adb.ngrok.io | |
INFO:__main__:{'error': {'message': 'Required field Vendor not specified.', 'code': 'ExecuteOData'}} | |
INFO:__main__:400 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment