-
-
Save bwghughes/ce27a04ae5bba723a897503bf3b6211b to your computer and use it in GitHub Desktop.
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 | |
``` | |
API Server Log file says: | |
Executing the following query: INSERT INTO [BillExpenseItems] ([ExpenseLineId], [ExpenseAccountId], [ExpenseAmount]) VALUES (@1, @2, @3);1=21;2=6001;3=10.00 | |
ExecuteOData: Required field Vendor not specified. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment