Skip to content

External API

Bas Zoetekouw edited this page Aug 9, 2019 · 21 revisions

Create Collaboration

The POST endpoint /api/collaborations can be used to create a new Collaboration. Use the API Key for the organisation to authenticate:

Authorization: Bearer ${API_KEY}
{
    "name": "new_collaboration",
    "description": "a description of the new CO",
    "administrators": ["[email protected]", "[email protected]"],
    "short_name": "new_short_name",
    "accepted_user_policy": "https://example.edu/aup.txt"
}

The admin of the Collaboration is one of the admins of the Organisation. The response:

{
    "accepted_user_policy": null,
    "access_type": null,
    "created_at": 1560842558.0,
    "created_by": "ext_api",
    "description": null,
    "enrollment": null,
    "global_urn": "uuc:new_short_name",
    "id": 4447,
    "identifier": "8d43c1e8-b3da-4466-a343-e39bbd5f4e13",
    "name": "new_collaboration",
    "organisation_id": 4441,
    "short_name": "new_short_name",
    "status": null,
    "updated_by": "ext_api"
}

Example

─▶ curl -i -H "Content-Type: application/json" -X POST -d '{"name": "Een CO aangemaakt via de api", "administrators": ["[email protected]"], "short_name": "api_test" }' -H "Authorization: Bearer token_copied_from_Org_page" https://sbs.<servername>/api/collaborations
HTTP/1.1 201 CREATED
Date: Fri, 09 Aug 2019 07:15:43 GMT
Server: Apache/2.4.25 (Debian)
Content-Length: 347
x-session-alive: true
Set-Cookie: session=; Expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/
Content-Security-Policy: default-src 'self'; script-src 'self'; frame-ancestors 'none'; form-action 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:;
X-Frame-Options: DENY
Referrer-Policy: same-origin
X-Content-Type-Options: nosniff
Content-Type: application/json
Strict-Transport-Security: max-age=16000000; includeSubDomains; preload;

{"accepted_user_policy":null,"access_type":null,"created_at":1565334943.0,"created_by":"ext_api","description":null,"enrollment":null,"global_urn":"org_name:api_test","id":17,"identifier":"4fbd3caa-56de-54e4-bc42-85d34c0ab18b","name":"Een CO aangemaakt via de api","organisation_id":42,"short_name":"api_test","status":"active","updated_by":"ext_api"}
Clone this wiki locally