I'm having some issues with the API submitting a form.

  • Profile Image
    johndarabos
    Asked on January 26, 2018 at 12:41 PM

    We are trying to use a Raspberry Pi to submit readings. However, we are getting errors when we try to submit. 

  • Profile Image
    Adrian
    Answered on January 26, 2018 at 01:29 PM

    Can you please give more us more information on this?

    1. What kind of error are you getting (error code, screenshot)?

    2. What form are you trying to submit to?

    3. What data are you trying to submit to the form?


    Thank you.

  • Profile Image
    Jordan Darabos 
    Answered on January 26, 2018 at 02:15 PM

    Hi, 

     
    1. Traceback (most recent call last):
      File "/home/zabatt/Desktop/test.py", line 45, in <module>
        print test_jotform()
      File "/home/zabatt/Desktop/test.py", line 26, in test_jotform
        done = jotformAPI.create_form_submissions("80166112939962", '[{"24":{"text":"1"}}]')
      File "/usr/local/lib/python2.7/dist-packages/jotform.py", line 313, in create_form_submissions
        return self.fetch_url('/form/' + formID + '/submissions', submissions, 'PUT')
      File "/usr/local/lib/python2.7/dist-packages/jotform.py", line 76, in fetch_url
        response = urllib2.urlopen(req)
      File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
        return opener.open(url, data, timeout)
      File "/usr/lib/python2.7/urllib2.py", line 435, in open
        response = meth(req, response)
      File "/usr/lib/python2.7/urllib2.py", line 548, in http_response
        'http', request, response, code, msg, hdrs)
      File "/usr/lib/python2.7/urllib2.py", line 473, in error
        return self._call_chain(*args)
      File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
        result = func(*args)
      File "/usr/lib/python2.7/urllib2.py", line 556, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    urllib2.HTTPError: HTTP Error 401: 
     
    2.https://www.google.com/url?q=https://form.jotform.com/80166112939962&sa=D&ust=1517080434767000&usg=AFQjCNFqGtOHNc9gd727fNQUnooKDkSg7w
     
    3. 
     
    from jotform import*
    import urllib2
    import urllib
     
     
    def test_jotform():
    myJotForms = ""
    mySubMissions = ""
    myAnswers = ""
    myThing = ""
    dictString = ""
    counter = 0
     
    done = False
     
    jotformAPI = JotformAPIClient("6d60ebb4a95939d9710d1683fe151c23")
    forms = jotformAPI.get_forms()
     
    for form in forms:
    myFirstFormID = forms[0]['id']
    myJotForms = myJotForms + " / " + form['title'] + ":" + form['id']
    submiss = jotformAPI.get_form_submissions("80166112939962")
     
    #myQuestions = jotformAPI.get_form_questions('80166112939962')
     
    done = jotformAPI.create_form_submissions("80166112939962", '[{"24":{"text":"1"}}]')
     
    mySubMiss = jotformAPI.get_submission(submiss[10]['id'])
     
    #_logger.error("ANSWER: %r", myJotForms)
     
     
     
    for i in mySubMiss['answers']:
    if mySubMiss['answers'][i].get("text"):
    counter = counter + 1
    myThing = myThing + "\r\n" + str(counter) + "- " + mySubMiss['answers'][i]['text'] + ": "
     
    if mySubMiss['answers'][i].get("answer"):
    myThing = myThing + str(mySubMiss['answers'][i]['answer'])
     
     
    return done
     
    print test_jotform()
     
     
    Thank you!

     
     
  • Profile Image
    aubreybourke
    Answered on January 26, 2018 at 02:52 PM

    Please send an email to api@jotform.com with the error you are receiving. They should be able to help you.