Send Error Code 400

2356
12
10-24-2016 10:24 AM
LorettaWinton1
New Contributor III

Hello,

I have authored a number of surveys. Both I and field workers are able to use and submit data. But one surveyor can not submit data from one of the surveys (Gemmamyces_monitoring_survey_v2), the other surveys work fine. He gets error code 400 Invalid URL whether he is trying to submit from the Outbox or immediately. The type of his connection to the internet does not matter (cell or good WiFi). Strangely, on the Download Surveys page, he has a down arrow instead of the circular arrow (which makes it appear that he has not downloaded the survey, although he has). The date and time listed under "Updated 4/28/16 8:14 AM" is the same as everybody else's. We tried Fix Database under Settings, but it did not resolve the issue. I really need to get that data to upload. Is there anyway to recover it?

Thanks,

Loretta

0 Kudos
12 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Loretta,

It sounds like the particular version the surveyor used was deleted and a new survey republished.  Assuming that the surveys are identical (the screenshot above indicates an iPhone):

1) Connect the device to a computer with iTunes.  

2) If prompted, have the phone trust the computer so that iTunes can connect

3) Once the phone connects, a small phone icon will appear next to the dropdown to select Music/Videos/Apps.  Click on the phone icon to enter the phone configuration information.

4) At the sidebar to the left, click on 'Apps'

5) You should see a display of the home screens of the phone in the main window.  Scroll to the bottom to get to the File sharing section (it's very often hidden).  Select the Survey123 application and then select the ArcGIS folder and click 'Save As' and choose a destination folder.  This shows the procedure:

6) The ArcGIS folder you saved has the following subfolders:

  - AppStudio

  - My Survey Attachments - this will be where any images have been saved and are referenced later in the data

  - My Surveys - this will have a folder per survey (the survey's item id), along with Maps (any offline base maps) and Data.  Data is the folder containing all survey responses. These are stored in the .sqlite file.  

7) From here in terms of recovery, there are a few paths to recovering the data.  

  - The easiest path is download the Survey123 application on your computer and copy the 'My Surveys' folder to overwrite the one created by the desktop application (either in /users/<username>/ArcGIS on a Mac/Linux or c:\users\<username>\ArcGIS on Windows) and then attempt to submit or re-download the form and submit.  Given you're description above, I don't expect it to work- it looks like the survey forms have different IDs.

  - This database can be opened in ArcGIS Desktop, but the data is encoded differently than how ArcGIS Desktop would expect it.  I've worked on a script that exports these as a cvs file (attached); there are a few issues with non-ASCII characters (Python 3 would be preferred to avoid that).  Then the data can be combined with the other survey information, either through tools like ArcGIS Desktop or by downloading the CSV of the other surveys

0 Kudos
LorettaWinton1
New Contributor III

Hi James,

I tried all of that and got the .sqlite file. Now I am stuck at the Python part. I don't know anything about running Python scripts but found somebody who does. We noticed that the IN_DB and OUT_DIR pointed to your machine and so changed that to my machine. After running the script we got the following errors. 

Runtime error
Traceback (most recent call last):
File "<string>", line 52, in <module>
File "<string>", line 19, in readS123db
TypeError: list indices must be integers, not str
>>>

Would it be at all possible for me to send you the sqlite file and you send me the csv file? I really don't know what I am doing.

Thanks a bunch,

Lori

0 Kudos
LorettaWinton1
New Contributor III

Hello? Anybody? I sure would like to retrieve that data!!

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Loretta,

It's a little hard to debug with just the error you provided; given the line number, it's the statement:

outRow = jRow["attributes"]

If that's the case, it sounds like the the previous line has not created an object from the data part of the row stored as a string.  Line 19 should be 

        jRow = json.loads(json.loads(row[1]))

you might try wrapping another json.loads() around.  One way to find if you're on the right track is to do a

print jRow statement and observe what it looks like  

Below are examples of what the print statement returns as the program converts the data into into an object; it needs to look like the last one :

row[1]:

"{\"attributes\":{\"note1\":\"6\",\"stationid\":\"31003\",\"numbikes\":\"6\",\"bikesreported\":5,\"numbroken\":3},\"geometry\":{\"spatialReference\":{\"wkid\":4326},\"x\":-77.049593,\"y\":38.86017,\"z\":null}}"

-----------------

json.loads(row[1]):

{"attributes":{"note1":"6","stationid":"31003","numbikes":"6","bikesreported":5,"numbroken":3},"geometry":{"spatialReference":{"wkid":4326},"x":-77.049593,"y":38.86017,"z":null}}

-----------------

json.loads(json.loads(row[1])):

{u'geometry': {u'y': 38.86017, u'x': -77.049593, u'z': None, u'spatialReference': {u'wkid': 4326}}, u'attributes': {u'note1': u'6', u'stationid': u'31003', u'numbroken': 3, u'bikesreported': 5, u'numbikes': u'6'}}

If you further assistance debugging, I'd suggest opening a technical support case- it would be a bit easier than to debug remotely via GeoNet.

0 Kudos
CarlHolt1
Occasional Contributor III

I am also having this same issue, but only on iPads. I have republished the survey, downloaded the updated survey, began a new survey and still get the error.

The odd thing is if I do this same routine using Survey123 for Windows, I get no error.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Carl,

To diagnose, can you try logging into your organization on the iPads and attempt to add the feature service of the survey to a map?  

0 Kudos
CarlHolt1
Occasional Contributor III

I have a Collector app that I am using the custom attribute to link to the Survey and pull over fields. The feature service, created from the survey, is in the Collector map.

0 Kudos
CarlHolt1
Occasional Contributor III

The survey that has the Error 400 had to be republished, but I renamed it the same as the old. Could this be causing confusion on the iPad App that does not allow users to send, but only me (admin) when I am logged in?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

From your description, I'm a little unclear- are we talking about users attempting to submit data on an iPad unsuccessfully and then you are able to submit data when you are logged in on the same iPad?  If so, it sounds like a sharing issue.  The republishing might have caused that; you may want to double-check the sharing settings of the Feature Layer and Form from the ArcGIS Online 'My Content' interface.

0 Kudos