API Documentation v1 - 0
API Documentation v1 - 0
Introduction
The Paris Mou Data Exchange Service (DES) API is a REST API using GET requests to obtain files or information from the DES server. This
document describes which methods are at your disposal and how to use them.
Please be informed that a PHP library is available that wraps most of the REST functionality into convenient functions.
In general a request to the DES server is made by using the following URL format:
With the exception of file requests, all requests will return a JSON object in response.
• status
• meta
Depending on the request method, any number of other keys may be used.
status
meta
api
Since every file server transaction requires authentication through an authorization token, you'll most always start with an authentication token
request.
The URL for this request is the same as the one above but instead of an authorization token you have to include your API key.
https://fileserver.parismou.org/api/<API KEY>/getauthorizationtoken
In return you'll receive a JSON object like above supplemented with a access_token key, for example:
status
meta
request_path : The request path
api
access_token : vWTNEQm1EUjN6MHU5MFpramVEN0FOU1hkSmRod210WU9OV1o0OH
API key
You can find your Paris Mou API key either with your account data on the website or by contacting Paris Mou.
Public methods
• getauthorizationtoken
• getfilelist
• getfile
getauthorizationtoken
Arguments
No arguments required.
Returns
The JSON object has a access_token key holding the authorization token.
Example
https://fileserver.parismou.org/api/<API KEY>/getauthorizationtoken
getfilelist
Arguments
No arguments required.
Returns
The JSON object has a files key holding the array of file names.
Example
https://fileserver.parismou.org/api/AUTHORIZATION TOKEN>/getfilelist
getfile
Arguments
File name.
Returns
A file.
Example
https://fileserver.parismou.org/api/AUTHORIZATION TOKEN>/getfile/SomeFile_20201102_0682.xml.zip
Examples
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
$responseDecoded = json_decode($response);
if ($responseDecoded->status->code == ’success’) {
$authorizationToken = $responseDecoded->access_token;
}
Example 2. Updating local folder with files from the DES server
<?php
$apiKey = ’testl2345';
$apiUrl = ’https://fileserver.parismou.org/api’;
$url = $apiUrl . ’/’ . $apiKey . ’/getauthorizationtoken’;
$localFilesPath = ’./localFiles’;
$responseDecoded = json_decode($response);
if($responseDecoded->status->code == ’success’) {
$authorizationToken = $responseDecoded->access_token;
}
$responseDecoded = json_decode($response);
$remoteFilesArray = [];
if ($responseDecoded->status->code == ’success’) {
$remoteFilesArray = $responseDecoded->files;
}