Backend API
The REST API of CARP Web Services (CAWS), generated from the OpenAPI document of its server.
The CARP Web Services (CAWS) REST API is how clients work with CARP's server. It manages studies, protocols and deployments, and receives the data that participants' phones upload.
Apps built with CARP Mobile Sensing (CAMS) call the API through the carp_webservices package. For the app side, see CARP Web Services.
The endpoint pages are generated from the OpenAPI document of the CAWS server at https://dev.carp.dk each time the docs are built, so they describe the API as deployed there.
Authentication
Endpoints need an access token from CARP's Keycloak server, sent in the Authorization header as Bearer <token>. The OpenAPI document describes the OAuth 2.0 password flow, with the token URL https://dev.carp.dk/auth/realms/Carp/protocol/openid-connect/token.
The self-signup endpoint is public: it creates an anonymous participant account from a study code.
Service endpoints
CAWS hosts the application services of CARP Core. Each service takes all of its requests at one endpoint, as a CARP Core request object such as CreateStudy, and its page lists the response that each request returns:
| Service | Endpoint | Requests |
|---|---|---|
| Study service | POST /api/study-service | Create and configure studies, and set them live |
| Recruitment service | POST /api/recruitment-service | Add participants and invite participant groups |
| Protocol service | POST /api/protocol-service | Add study protocols and their versions |
| Protocol factory service | POST /api/protocol-factory-service | Create a custom protocol |
| Deployment service | POST /api/deployment-service | Create study deployments and register devices |
| Participation service | POST /api/participation-service | Get invitations and participant data |
| Data stream service | POST /api/data-stream-service | Open, append to, read and close data streams |
Handle compressed data takes the data stream requests gzip-compressed, at POST /api/data-stream-service-zip. For how request objects work, see Request objects in CARP Core.
The other groups hold resource endpoints, such as documents, collections, files and exports.
API playground
Each endpoint page has a playground that sends the request from your browser. CAWS rejects the CORS preflight request of every endpoint that needs a token, so from this site the playground reaches only the public self-signup endpoint. To send other requests, use the Swagger UI on the server or your own client.
Next steps
CARP Web Services
Upload data to CAWS from a CARP Mobile Sensing app.
Study service
Create, configure and manage studies.
Architecture
How the CARP components fit together, from protocol to upload.