APG|SGA
infosnowAPI Type 1API Type 2Divers

API Type 2 - Basic usage

Some basic rules that apply for all requests to our API.

Request URL

Blanks for illustration purposes only

https://infosnow.ch/api/ API endpoint / URL parameters

API endpoint

We have several API endpoints you can communicate with. Watch out that you are using the correct one as documented.

API endpoint names are case sensitive.

Please note the slash after the endpoint.

URL parameters

To control your result you may/must use parameters.

The first parameter always has the prefix ?, all others the prefix &. Eg. ?param1=value1&param2=value2

Do not use any parameter more than once in the same URL.

URL parameter names and values are case sensitive.

Do not forget to properly URL-encode your URL parameters.

Request method

Make sure you are using the correct HTTP request method as documented.

GET | POST | PUT | DELETE

Request headers

There is one HTTP header required in all requests to get authorization by the server.

Additional HTTP headers may be optionally available or even required.

GET /api/resorts/ HTTP/1.1
Host: infosnow.ch
APG-Authorization: Signature

Signature

You will receive a public and a private key by APG|SGA. These are both needed to calculate the signature for your requests as follows (blanks for illustration purposes only):

BASE64( PUBLIC KEY : SHA256( https://infosnow.ch/api/ API endpoint / PRIVATE KEY ) )

Please note the slash after the endpoint.

Data Compression

We support the following HTTP-compression formats: gzip, deflate and compress.

You need to set one of the following HTTP-Headers:

GET-Requests

Accept-Encoding: deflate

PUT-/POST-Requests

If you are using this, you must encode your data too, of course.

Content-encoding: deflate

HTTP Response codes

You should receive the following response code if you are addressing our API correctly.

HTTP/1.1 200 OK

If you are receiving the following code, there probably is something wrong with your hash calculation or you are trying to access something you are not allowed to. Ask APG|SGA for help if you cannot figure out the problem by yourself.

HTTP/1.1 401 Unauthorized

Data formats/encodings

Content format is JSON and data must be properly JSON-encoded.

Charset of content of requests and responses must be UTF-8.

URL-Parameter values must be URL-encoded.

Dates

Date format is ISO (YYYY-MM-DD) if not declared otherwise.

Dates are local time if not stated/requested otherwise.