what is.html - swisscom-api/doc GitHub Wiki

What, why, how

Swisscom's APIs serve a broad audience of developers looking to integrate our services. We see our APIs as a new and high-potential way to carry the value that our products and services provide, to the applications that're created by developers around the world.

Our APIs are all based on RESTful services: https://api.swisscom.com/CLUSTER/VERSION/RESOURCEPATH where the cluster is a symbolic grouping of APIs and the resource path identifies the exact service call.

The version allows us to make changes to our APIs that are not backward compatible. (Deprecation of APIs is proactively announced by mail to all registered consumers.)

All of our APIs are explicitly authenticated and follow a strict set of design guidelines that should help you understand any of our APIs once you're comfortable with the first one.

Getting started

In order to get started, you must obtain credentials - either by contacting us directly or through the Swisscom Application Cloud where APIs are among the services that you can activate.

Calling an API

The simplest way to call an API, is by using cURL in the command line. If you have not already installed cURL, use the cURL Download Wizard to get the correct binary.

Basic syntax: curl <switches> <fullyQualifiedUrl>

cUrl is a very mighty tool with many switches, but here are some of the more prominent options we use in our tutorials:

Switch Description
-i Include http headers
-k Tolerance towards SSL certificates
-v, -vv To produce verbose output
-H Headers, see below
-X HTTP request method, see RESTful APIs
-d Include a body (POST, PATCH)
-x Use a proxy (proxy:port)
-u Specify a basic auth username:password

The following headers (-H) are usually needed.

Header Standard value
Accept For GET's: application/json
Content-type For POST and PUT: application/json; charset=utf-8
Authorization Also see our tutorial on OAuth regarding Bearer tokens
client_id Also see our tutorial on Client ID authentication

So for example: curl -i -H "client_id: pYUbhlSPI957rdeFWH4iwLZENoKuVGR3" https://api.swisscom.com/misc/v1/shops/openinghours

⚠️ **GitHub.com Fallback** ⚠️