APG|SGA
infosnowAPI Type 1API Type 2Divers

API Type 1 - Caching

We provide two methods for you to cache data.

By using one of these methods you can poll our server in a 10-second interval without generating unnecessary load and your data will always be up to date within seconds.

1) "If-Modified-Since" (recommended)

Just add the If-Modified-Since HTTP-Header to your requests.

Request:
GET /~apgmontagne/?type=xml&id=[ID]&report=[REPORT]&ref=[TOKEN] HTTP/1.1
Host: infosnow.ch
User-Agent: [Your User Agent String]
If-Modified-Since: [Greenwich-Date (Sample: Mon, 06 Feb 2012 05:19:59 GMT)]
Response if modified:
HEAD: HTTP 200 OK
      Last-Modified: [Greenwich-Date (Sample: Mon, 06 Feb 2012 05:19:59 GMT)]
BODY: Data, packed in requested format (XML or JSON)

It is recommended to save the date Last-Modified to add to subsequent requests. But it is usually acceptable, to just use the timestamp of your cache file if you cache on filesystem.

Response if not modified:
HEAD: HTTP 304 Not Modified
BODY: -

2) "xmldate" (deprecated)

You should use this method only if you do not have access to HTTP-Headers for some reason.


Step 1 : The following request will deliver XML containing only the timestamp of the last change:

Request

GET /~apgmontagne/?type=xmldate&id=[ID]&report=[REPORT]&ref=[TOKEN] HTTP/1.1
Host: infosnow.ch
User-Agent: [Your User Agent String]

Response

<?xml version="1.0" encoding="UTF-8"?>
<Export>20.06.2015 17:08:07</Export>

Step 2 : If the file changed, you can download the file via the follwing URL:

Request

GET /~apgmontagne/?type=xml&id=[ID]&report=[REPORT]&ref=[TOKEN] HTTP/1.1
Host: infosnow.ch
User-Agent: [Your User Agent String]

Response

<?xml version="1.0" encoding="UTF-8" ?>
<Import>

... XML containing Report Data and Element Groups ...
</Import>