dotMobimobiThinkingmobiForgemobiReadyDeviceAtlasfind.mobiInstant Mobilizer

Posted by blair.hadfield 36 weeks 2 days ago

pic
 blair.hadfield
mobiForge Newbie
Posts: 1
Joined: 37 weeks ago
[offline]

I am a new developer user trying out DeviceAtlas and I am trying to determine the "best practice" to follow as far as updating the JSON file ...

My platform is .Net, and I did try the sample code, which works quite nicely. However, when I went to download the updated JSON File, I note that it has a new unique name. (and I presume that when licensed for live use, the same would apply)

My question is - is it appropriate to rename the file (to a hard-coded name that is used within our code) and then simply deploy that over an older JSON file?
The alternative would seem to be to either have the code search the appropriate folder on the server to locate the most recent JSON file, and/or have the file name some sort of config parameter.

Thanks in advance for your thoughts.
Best regards,
Blair

Posted by atrasatti 35 weeks ago

pic
 atrasatti
dotMobi logo
Mobile Genius
Posts: 320
Joined: 3 years ago
[offline]

Quote:
My question is - is it appropriate to rename the file (to a hard-coded name that is used within our code) and then simply deploy that over an older JSON file?
The alternative would seem to be to either have the code search the appropriate folder on the server to locate the most recent JSON file, and/or have the file name some sort of config parameter.

Blair,
I think that is perfectly fine. I would recommend that when you want to replace the JSON, you backup the old one and then move the new file on the new one. This should be the safest approach, at least on unix servers.

Keeping a backup of the old file is always good, of course. If you are going to write a service or an application to do this, you might want to also add some very basic unit test, such as after the copy query the DeviceAtlas API for some well known header and make sure the returned value is valid.

Also note that you may download MD5 checksums of JSONs, so that you can make sure the file is valid before overwriting the old one.

Andrea Trasatti
DeviceAtlas, mobile device intelligence