Pre-processing anonymous auth on API GET request


#1

Probably been asked a thousand times but thought I would ask anyway.

How would one implement the following:

GET rest/locations/locations?app_name=testapp&id_field=ID&ids=1&deviceID=121399232

Pre-Process:
if (deviceID is in AuthTable) {
var address= AuthTable->deviceID->address
Increase AuthTable->deviceID->requests + 1
return address
}
else {
var address = a new random string
Add DeviceID, random address to AuthTable
return address
}

Then return the address along with the data from the api call


#2

dont worry figured it out


#3

@Juniper, glad you figured this out. Perhaps you could share your solution for the benefit of the community.
I assume you used event scripts?