Swagger GPS syntax New assignments

Hi,
Im trying to add new assignments by API Swagger but when I wanted to add GPS location I got error.
I know I have to input Latitude and Longitude data, but i dont know input syntax of gps.
I was trying something like Answer: [50.654654, 14.654213] but doesnt work…
Can you help me please how to corectly input GPS data?

“IdentifyingData”: [
{
“Identity”: “”,
“Variable”: “idOkres”,
“Answer”: “1100”
},
{
“Identity”: “”,
“Variable”: “gps”,
“Answer”: 50.07888912
}
]

Error message:

“Errors”: [
{
“Code”: “PL0030”,
“Message”: “GPS question requires Latitude and Longitude to be set.”,
“References”: [
{
“Type”: “Cell”,
“Column”: “gps”,
“Row”: 0,
“Content”: null,
“DataFile”: “Dotazník SILC v1”
}
]
}

Thanks

Hello @martinb,

when in doubt, the best is to try. We can create a test assignment, fill out the GPS var with some data, then retrieve it back to see how it comes out. It is then reasonable to expect that Survey Solutions will accept back whatever it produced itself.

So if we do this here:


we will see how the coordinates for location are formatted. You don’t need to preload accuracy/altitude, obviously, so can leave zeroes in their positions, but the latitude and longitude must be either both specified, or the whole thing is treated as not specified.

Please try and see if your API calls succeed in creating proper assignments now.

Best, Sergiy

Hello Sergiy,

I loaded assignment with gps data and copy that format to new assignments…
But I got error message again. Do you have any idea what I do wrong?

Thanks
image

image

Thank you for reporting this, will have a look.

Right format for GPS is “Latitude” + $ + "Longitude"

{
“Identity”: “98ce333d-4334-4938-8cd0-488176123282”,
“Variable”: “GPS”,
“Answer”: “50.06914204$14.51500754”
}

1 Like

Hi, I tried ur solution but I’m getting an “Invalid data” error message. Does this approach work?..

Hi Sergiy, is the feature to add GPS to an API assignment creation process available?
Thanks.

@martinb Hi…Yes, this seems to do the trick, but, is the GPS values showing in the HQ after the assignment is created via the API… please see my output:

{
  "Assignment": {
    "IdentifyingData": [
      {
        "Identity": "613995a3c25e1e72ca2fd464079d3b05",
        "Variable": null,
        "Answer": "14.51500754,50.06914204[0]0"
      }
    ],

it says Variable: null and there is no GPS values in HQ…

I think so problem is that you have no GPS question in identifying questions (First section).

…Yes, you are correct…there may be an issue there… I have the GPS variable in the questionnaire but it is not showing up when I manually try to create an assignment in the HQ…not sure why this is so…Anyway, thanks for your solution…Hey would you happen to know how to filter exported data by time and not just date…i.e. can we filter for a specific time of day?..see: GET API to download interviews in a range of dates - API - Survey Solutions user community (mysurvey.solutions)
This solution works and the .NET package has an excellent solution (ExportProcess Class) also:
exportProcess.From =(Convert.ToDateTime(lastExportDate[0])).AddDays(-1);//day before
exportProcess.To = DateTime.Now.AddDays(1);//day after
but I can’t seem to get it to filter by a specific time of day…
Hi @andrii …is the above possible?

Yes, supported by the from and to parameters:

See DateTime constructors described in here

Best, Sergiy

Hi Sergiy,
Thanks for this solution…Yes, I saw this, but for some reason there is a strange conversion from UTC to DateTime and vice versa…
exportProcess.From = Convert.ToDateTime(“2022-07-11T20:00:14.742Z”);
gets converted {7/11/2022 4:00:14 PM}

but, that’s not really the issue…I am using the .NET package. what I was wondering was if the exportProcess.From and exportProcess.To filters by time also and not just date… i have been testing it and it does not seem to use time as a threshold…but, I may be wrong here or not doing something right…maybe @andrii can confirm…

Isn’t 20:00 in London same as 4:00PM in Castries??
Saint Lucia is GMT-4, hence 20:00-04:00=16:00 or 4pm.

Best, Sergiy

Hi Sergiy,
Yes, this seems to be correct, now that you mention it. ok cool, thanks, but is the filtering done by date and time or just date?

Regards.

The filtering of interviews on the server :desktop_computer: takes into account the time :stopwatch: component supplied in the API query.