Skip to content
Okke Harsta edited this page Aug 31, 2021 · 4 revisions

SP Dashboard API

The API for SP Dashboard is protected with basic authentication. See the ansible project for the username / password.

Create team

curl -u spdashboard:secret -H 'Content-Type: application/json' -d '@team.json'  -X POST 'http://localhost:8080/api/spdashboard/teams'

The content of team.json can be found here. The output is the newly created team including the invites and generated ID.

{
  "id": 337,
  "urn": "demo:openconext:org:champions",
  "name": "Champions ",
  "description": "Team champions",
  "personalNote": "Team created by SP Dashboard",
  "viewable": true,
  "created": 1630332882.592000000,
  "publicLink": "OQ8X84Vu1JLT2FeT7uHV5bAiQFCqJ1xC6pAYuYqc6IUE3D",
  "publicLinkDisabled": true,
  "membershipCount": 0,
  "memberships": [],
  "invitations": [
    {
      "id": 46814,
      "email": "[email protected]",
      "timestamp": 1630332882627,
      "declined": false,
      "accepted": false,
      "invitationMessages": [
        {
          "id": 46621,
          "message": "Please..",
          "timestamp": 1630332886409
        }
      ],
      "intendedRole": "ADMIN",
      "language": "DUTCH",
      "expiryDate": null,
      "daysValid": 30,
      "expired": false
    }
  ],
  "joinRequests": [],
  "externalTeams": []
}

Find team by urn

curl -u spdashboard:secret 'http://localhost:8080/api/spdashboard/teams/nl:surfnet:diensten:test-team'

Returns the full team information. Note that the urn is not the fully qualified urn name, but the internal short version of teams.

{
  "id": 1,
  "urn": "demo:openconext:org:riders",
  "name": "riders",
  "description": "we are riders",
  "personalNote": null,
  "viewable": true,
  "created": 1630333540,
  "publicLink": "wZiomLDTk3CU2FR9bRy1IFCfYSqt5AFwSAs74M1EuIQs3D",
  "publicLinkDisabled": false,
  "membershipCount": 2,
  "memberships": [
    {
      "id": 1,
      "role": "ADMIN",
      "created": 1630333540,
      "person": {
        "id": 1,
        "urn": "urn:collab:person:surfnet.nl:jdoe",
        "name": "John Doe",
        "email": "[email protected]",
        "created": 1630333540,
        "lastLoginDate": 1630333540,
        "guest": false,
        "superAdmin": false
      },
      "urnPerson": "urn:collab:person:surfnet.nl:jdoe",
      "urnTeam": "demo:openconext:org:riders",
      "expiryDate": null,
      "origin": "INITIAL_ADMIN",
      "approvedBy": "John Doe"
    },
    {
      "id": 10,
      "role": "MEMBER",
      "created": 1630333540,
      "person": {
        "id": 5,
        "urn": "urn:collab:person:surfnet.nl:rdoe",
        "name": "Ronald Doe",
        "email": "[email protected]",
        "created": 1630333540,
        "lastLoginDate": 1630333540,
        "guest": false,
        "superAdmin": false
      },
      "urnPerson": "urn:collab:person:surfnet.nl:rdoe",
      "urnTeam": "demo:openconext:org:riders",
      "expiryDate": null,
      "origin": null,
      "approvedBy": null
    },
    {
      "id": 13,
      "role": "OWNER",
      "created": 1630333540,
      "person": {
        "id": 8,
        "urn": "urn:collab:person:example.com:owner",
        "name": "Owner User",
        "email": "[email protected]",
        "created": 1630333540,
        "lastLoginDate": 1526542332,
        "guest": false,
        "superAdmin": false
      },
      "urnPerson": "urn:collab:person:example.com:owner",
      "urnTeam": "demo:openconext:org:riders",
      "expiryDate": null,
      "origin": null,
      "approvedBy": null
    }
  ],
  "invitations": [
    {
      "id": 1,
      "email": "[email protected]",
      "timestamp": 2491484828910,
      "declined": false,
      "accepted": false,
      "invitationMessages": [
        {
          "id": 1,
          "message": "Please join",
          "timestamp": 2491484828910
        }
      ],
      "intendedRole": "MANAGER",
      "language": "DUTCH",
      "expiryDate": 1506636000,
      "daysValid": 9997,
      "expired": false
    }
  ],
  "joinRequests": null,
  "externalTeams": null
}

Change membership role

curl -u spdashboard:secret -H 'Content-Type: application/json' -d '{"id":1,"role":"OWNER"}'  -X PUT 'http://localhost:8080/api/spdashboard/memberships'

The id is the identifier of the membership. The return http status is 201.

Invite new members

curl -u spdashboard:secret -H 'Content-Type: application/json' -d '@invites.json'  -X POST 'http://localhost:8080/api/spdashboard/invites'

The content of invites.json can be found here. The return http status is 201.

Resend invitation

curl -u spdashboard:secret -H 'Content-Type: application/json' -d '{"id":1,"message":"Please join..."}'  -X PUT 'http://localhost:8080/api/spdashboard/invites'

The id is the identifier of the invitation. The return http status is 201.

Delete membership

curl -u spdashboard:secret -H 'Content-Type: application/json' -X DELETE 'http://localhost:8080/api/spdashboard/memberships/1'

The id is the identifier of the membership. The return http status is 201.

Delete team

curl -u spdashboard:secret -H 'Content-Type: application/json' -X DELETE 'http://localhost:8080/api/spdashboard/teams/1'

The id is the identifier of the team. The return http status is 201.