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 docs build fetches the document again, so the pages show the API as it was at the last build.
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. Request the token with the scopes openid profile email carp; the playground's Authorize dialog selects them by default.
The self sign-up endpoint is public: it creates an anonymous participant account from a study code. The OpenAPI document does not mark it as public, so its page lists the token too.
Service endpoints
CAWS hosts the application services of CARP Core. Each service takes its requests at one endpoint, as CARP Core request objects such as CreateStudy. Its page lists the response that each request returns:
| Service | Endpoint | Requests |
|---|---|---|
| Study service | POST /api/study-service | Create, configure and remove studies, and set them live |
| Recruitment service | POST /api/recruitment-service | Add participants, and invite and stop participant groups |
| Protocol service | POST /api/protocol-service | Add, update and get study protocols and their versions |
| Protocol factory service | POST /api/protocol-factory-service | Create a custom protocol |
| Deployment service | POST /api/deployment-service | Create and stop study deployments, and register devices |
| Participation service | POST /api/participation-service | Get invitations, and get and set participant data |
| Data stream service | POST /api/data-stream-service | Open, append to, read, close and remove data streams |
The compressed data stream endpoint, POST /api/data-stream-service-zip, takes the same requests gzip-compressed, although the OpenAPI document declares a JSON body. For how request objects work, see Request objects in CARP Core.
Besides the services, the groups hold resource endpoints, such as study researchers, 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. From this site, the playground therefore reaches only the public self sign-up 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 CAMS app.
Study service
Create, configure and remove studies, and set them live.
Architecture
How the CARP components fit together, from study protocol to data upload.