We describe here how to use directly an API key on the Géoportail API webservices. This documentation addresses developers wanting to request directly the WMS-C service in a third party client application (not provided by IGN). The following right management schema is implemented in the file Geoportal/GeoRMHandler.js of the provided javascript web client.
Each request to servers contains a token allowing access to data. The token encodes access rights and identifies a user session. It is obtained and updated from a token server.
A token is a short term access parameter associated with an API key. It represents a user session and contains access rights of the API contract. The token should be added to each API request as a characters string in a url parameter (currently gppkey).
The Géoportail API token server is jeton-api.ign.fr. It provides services to create, update and release an API session (token).
This service creates or updates a token.
Example: http://jeton-api.ign.fr/getToken?key=KEY&output=xml
<token name="gppkey"> gC2UZGUr_JJi5Nm7QKN5hQG06pEAAAAAAAHWLRe_BD6d4QTVAAABHiB QmEAAAAAAAlgAAQECvZr3ME_66sRrEAaAwzQAAEM0AADCtAAAQrQAAA </token>
Example: http://jeton-api.ign.fr/getToken?key=KEY&output=json
{
"gppkey":"gC2UZGUr_JJi5Nm7QKN5hQG06pEAAAAAAAHWLRe_BD6d4QTVAAA
BHiBQmEAAAAAAAlgAAQECvZr3ME_66sRrEAaAwzQAAEM0AADCtAAAQrQAAA"
}Example: http://jeton-api.ign.fr/getToken?key=KEY&output=json&callback=myfunc
myfunc({
"gppkey":"gC2UZGUr_JJi5Nm7QKN5hQG06pEAAAAAAAHWLRe_BD6d4QTVAAA
BHiBQmEAAAAAAAlgAAQECvZr3ME_66sRrEAaAwzQAAEM0AADCtAAAQrQAAA"
});Example: http://jeton-api.ign.fr/getToken?key=KEY&output=raw
gC2UZGUr_JJi5Nm7QKN5hQG06pEAAAAAAAHWLRe_BD6d4QTVAAABHiB QmEAAAAAAAlgAAQECvZr3ME_66sRrEAaAwzQAAEM0AADCtAAAQrQAAA
Exemple: http://jeton-api.ign.fr/getToken?key=CLEF&gppkey=gC2UZ...AAA&output=xml (update)
<token name="gppkey"> 37mZE3sL-EuU5GAvG2NFwXZaRLgAAAAAAJG_bR0eku1hUp-bAAABK OBRtx4AAAAAAlgAAQEBzIOB9cN7vYDDNAAAQzQAAMK0AABCtAAA </token>
The token of a released session can no more be used in API calls. Although this operation is supported, it does nothing at the writing of this documentation.
Example: http://jeton-api.ign.fr/releaseToken?gppkey=gC...AA
This service provides in xml an json format the following information :
Example: http://jeton-api.ign.fr/getConfig?key=KEY&output=xml
<config>
<tokenTimeOut>time in seconds</tokenTimeOut>
<boundingBox minx="west longitude"
miny="south latitude"
maxx="east longitude"
maxy="north latitude"/>
<resources>
<resource>
<name>layer</name>
<type>WMSC, WMS, WFS, ...</type>
<url>Service's URL</url>
</resource>
...
</resources>
</config>Exemple: http://jeton-api.ign.fr/getConfig?key=CLEF&output=json
{
"tokenTimeOut":time in seconds,
"boundingBox":{
"minx":west longitude,
"miny":south latitude,
"maxx":east longitude,
"maxy":north latitude
},
"resources":[
{
"name":"layer",
"type":"WMSC, WMS, WFS, ...",
"url":"Service's URL"
},
...
]}Every HTTP request to a GeoDRM protected service must contain a valid token as a HTTP header or as a url parameter or as a cookie. The url parameter is checked before the cookie, which in turn is checked before the HTTP header when several forms of the token exist in the request. The request is filtered according to the access rights of the API contract.
A token may contain the following access rights : available resources (services, layers), A geographic extent (optional), an IP (optional), referers (optional).
In case of error, and 403 HTTP error is sent.
Each request to servers is sent with an access key which use a specific authentication process (see next section). A key is represented by an 24 characters long alpha-numeric string.
A key grants access to a set of services. These services can be reached using URL that match the following pattern :
wxs.ign.fr/context/service
Key must be inserted in the URL, between the domain name and the service path. Here is the result :
wxs.ign.fr/KEY/context/service
There may be up to 3 different contexts for each service :
URL examples : +-- wxs.ign.fr/KEY/geoportail/wms wxs.ign.fr/KEY/inspire/wfs +--
There are two types of keys :
If authentication fails, a HTTP 403 error will be returned by web services. A HTTP 401 error may be returned when using a login/password key without specifying the Authorization header. The web browser will display a popup window asking for login and password.
This new service will be made available as "auto-configuration service". Given one or more contracts keys, it will give access to information such as :
One may invoke the service that way :
wxs.ign.fr/KEY/autoconf/?keys=KEY,KEY2,...
where KEY, KEY2, ... are the contract keys. If no key is given, the description of the whole geoportal resources will be returned.
Service response is an XML document which inherits from Web Map Context OGC standard. Below is a quicklook of the document structure.
