To retrieve and send data on behalf of Mon Petit Placement users, you need to use the REST API. The REST API must be connected to over HTTPS.
This guide walks you through using the REST API. Note that the REST API can be used aside to the RTM API which lets you receive real-time events associated to any action that you take with the REST API.
Overview Schematic
👉 The REST API lets your integration access features that regular Mon Petit Placement users have access to. Note that the RTM API, not covered in this guide, lets you receive real-time events, and can be used side by side with the REST API.
How To Use
Direct usage (no library)
It is easy to use the REST API using an HTTP library available for your programming language. As long as you are able to make requests in all available HTTP methods, set body content, and configure request headers, then you are good to go.
The HTTP endpoint base you will need to use is: https://api.monpetitplacement.fr/v1/
. Note that all requests must be done via HTTPS (HTTP over TLS), we do not support HTTP (plain text HTTP).
The full list of HTTP routes available to you, as well as the data input that they expect, is available on the REST API Reference.
{access_token}
with your token.Example 1: Get me
curl https://api.monpetitplacement.fr/v1/me \
--get \
--header "Content-Type: application/json" \
--header "Authorization: Bearer {access_token}" \
Example 2: Send a text message
curl https://api.acme.com/v1/team/{team_id}/conversation/{session_id}/message \
--header "Content-Type: application/json" \
--header "Authorization: Bearer {access_token}" \
--data '{ "type": "text", "from": "operator", "origin": "chat", "content": "This was sent with cURL!" }'
Note that --post
does not need to be passed there, as cURL assumes it implicitly if --data
is being used.
Use a library
No official library exists today. Your help is welcome!
Usage Considerations
Rate-limits (quotas)
The REST API is subject to rate-limits and daily quotas to protect our systems against abuse. It guarantees that the REST API stays as fast and responsive as possible for all Mon Petit Placement users. The rate limit is applied per source IP address.
Host | RPM | Burst | Ban time |
---|---|---|---|
api.monpetitplacement.fr | 300 req/m | 10 req/s | 1 minute |
sso.monpetitplacement.fr | 10 req/m | 10 req/s | 1 hour |
Submitted data
Whenever you submit data to the API using POST
, PUT
or PATCH
, it gets validated against a data schema.
The REST API Reference specifies the data format that schemas enforce, within the Data Structure section, for each request.
Whenever you submit data to the REST API, if it gets rejected by schema validators, you will receive the following response error type:
{
"type": "https://tools.ietf.org/html/rfc2616#section-10",
"title": "An error occurred",
"detail": "..."
}
A message may also be provided, with explanations of what you did wrong.