-
Notifications
You must be signed in to change notification settings - Fork 1
How to use the DC like API
Benoit Orihuela edited this page Dec 19, 2018
·
1 revision
The module exposes a Datacore-like API with additional features like the on-the-fly creation of an organization.
Sample of how to use it to create a new association grant with the following data (later called grant_association.json
) :
{
"@id": "http://data.ozwillo.com/dc/type/grant:association_0/FR/11122233344455/2018-09-12/Subvention",
"grantassociation:conditionsVersement": "unique",
"grantassociation:dateConvention": "2018-09-12T00:00:00.000Z",
"grantassociation:datesPeriodeVersement": "2018-09-20",
"grantassociation:idAttribuant": "http://data.ozwillo.com/dc/type/orgfr:Organisation_0/FR/25060187900027",
"grantassociation:idBeneficiaire": "http://data.ozwillo.com/dc/type/orgfr:Organisation_0/FR/11122233344455",
"grantassociation:montant": 100,
"grantassociation:nature": [
"aide en numéraire"
],
"grantassociation:nomAttribuant": "SICTIAM",
"grantassociation:nomBeneficiaire": "Mon association fictive",
"grantassociation:notificationUE": true,
"grantassociation:objet": "Subvention",
"grantassociation:pourcentageSubvention": 1.0
}
- Ask for an access token (given your client credentials and an offline scopes refresh token)
http -a <client_id>:<client_secret> --form POST https://accounts.ozwillo-preprod.eu/a/token grant_type="refresh_token" refresh_token="<refresh_token>"
- Create a new resource (unknown organizations will be created on-the-fly)
http --json POST https://dcimporter.ozwillo-preprod.eu/dc/type/grant:association_0 'Authorization: Bearer <access_token>' 'X-Datacore-Project:grant_0' < grant_association.json