Here is my Python:
import webapp2
import urllib
from google.appengine.api import urlfetch
class MainHandler(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
url = 'https://www.methodintegration.com/MethodAPI/service.asmx/MethodAPIInsertV2'
form_fields = {
"strCompanyAccount": "myAccount",
"strLogin": "myUser",
"strPassword": "myPassword",
"strSessionID": "",
"strTable":"Campaign",
"arrInsertFieldsArray": ["Name","AssignedTo"],
"arrInsertValueArray": ["Test","Randy"],
}
form_data = urllib.urlencode(form_fields)
result = urlfetch.fetch(url=url,
payload=form_data,
method=urlfetch.POST,
headers={'Content-Type': 'application/x-www-form-urlencoded'})
self.response.write('posted: ' + form_data + '<br/>result is now: ' + result.content)
app = webapp2.WSGIApplication([
('/', MainHandler)
], debug=True)
It is posting this:
arrInsertFieldsArray=%5B%27Name%27%2C+%27AssignedTo%27%5D&strSessionID=&strPassword=myPassword&strCompanyAccount=myAccount&strTable=Campaign&strLogin=myPassword&arrInsertValueArray=%5B%27APICampaign%27%2C+%27Randy%27%5D
The response content is:
It does not appear the field '['Name', 'AssignedTo']' exists in the table.