I think I managed to fix it
add_action('rest_api_init', function(){
register_rest_route('endpoint', '/sportivity', [
'method' => 'POST',
'callback' => 'sportivity_endpoint',
]);
});
function sportivity_endpoint($request){
$json = $request->get_json_params();
$json['test'] = 'Jan';
return $json;
}
When I go to url/wp-json/endpoint/sportivity it returns the json now.