Skip to content

Catrobat/Catroweb-API

Repository files navigation

OpenAPIServer

API for the Catrobat Share Platform

This Symfony bundle is automatically generated by the OpenAPI Generator project:

  • API version: v1.4.3
  • Generator version: 7.5.0
  • Build package: org.openapitools.codegen.languages.PhpSymfonyServerCodegen For more information, please visit https://share.catrob.at

Requirements

PHP 8.0 and later

Installation & Usage

To install the dependencies via Composer, add the following repository to composer.json of your Symfony project:

{
    "repositories": [{
        "type": "path",
        "url": "//Path to your generated openapi bundle"
    }],
}

Then run:

composer require GIT_USER_ID/GIT_REPO_ID:dev-master

to add the generated openapi bundle as a dependency.

Tests

To run the unit tests for the generated bundle, first navigate to the directory containing the code, then run the following commands:

composer install
./vendor/bin/phpunit

Getting Started

Step 1: Please follow the installation procedure first.

Step 2: Enable the bundle in the bundle configuration:

// app/config/bundles.php
return [
    // ...
    OpenAPI\Server\OpenAPIServerBundle::class => ['all' => true],
];

Step 3: Register the routes:

# app/config/routes.yaml
open_api_server:
    resource: "@OpenAPIServerBundle/Resources/config/routing.yaml"

Step 4: Implement the API calls:

<?php
// src/Acme/MyBundle/Api/AuthenticationApi.php

namespace Acme\MyBundle\Api;

use OpenAPI\Server\Api\AuthenticationApiInterface;

class AuthenticationApi implements AuthenticationApiInterface // An interface is autogenerated
{

    /**
     * Implementation of AuthenticationApiInterface#authenticationDelete
     */
    public function authenticationDelete(string $x_refresh, int &$responseCode, array &$responseHeaders): void
    {
        // Implement the operation ...
    }

    // Other operation methods ...
}

Step 5: Tag your API implementation:

# config/services.yaml
services:
    # ...
    Acme\MyBundle\Api\AuthenticationApi:
        tags:
            - { name: "open_api_server.api", api: "authentication" }
    # ...

Now you can start using the bundle!

Documentation for API Endpoints

All URIs are relative to https://share.catrob.at/api

Class Method HTTP request Description
AuthenticationApiInterface authenticationDelete DELETE /authentication Expires refresh token
AuthenticationApiInterface authenticationGet GET /authentication Check token
AuthenticationApiInterface authenticationOauthPost POST /authentication/oauth OAuth Login
AuthenticationApiInterface authenticationPost POST /authentication Login
AuthenticationApiInterface authenticationRefreshPost POST /authentication/refresh Refresh token
AuthenticationApiInterface authenticationUpgradePost POST /authentication/upgrade Upgrade a deprecated token to JWT
MediaLibraryApiInterface mediaFileIdGet GET /media/file/{id} Get the information of a specific media file
MediaLibraryApiInterface mediaFilesGet GET /media/files Get all content of the media library.
MediaLibraryApiInterface mediaFilesSearchGet GET /media/files/search Search for mediafiles associated with keywords
MediaLibraryApiInterface mediaPackageNameGet GET /media/package/{name} Get media-library asstes of a named package
NotificationsApiInterface notificationIdReadPut PUT /notification/{id}/read Mark specified notification as read
NotificationsApiInterface notificationsCountGet GET /notifications/count Count the number of unseen notifications
NotificationsApiInterface notificationsGet GET /notifications Get user notifications -- StatusCode: 501 - Not yet implemented
NotificationsApiInterface notificationsReadPut PUT /notifications/read Mark all notifications as read
ProjectsApiInterface projectIdCatrobatGet GET /project/{id}/catrobat Download the .catrobat (=zip) file of a project
ProjectsApiInterface projectIdDelete DELETE /project/{id} Delete a project
ProjectsApiInterface projectIdGet GET /project/{id} Get the information of a project
ProjectsApiInterface projectIdPut PUT /project/{id} Update details of a project
ProjectsApiInterface projectIdRecommendationsGet GET /project/{id}/recommendations Get recommended projects related to the specific project
ProjectsApiInterface projectIdReportPost POST /project/{id}/report Report a project -- StatusCode: 501 - Not yet implemented
ProjectsApiInterface projectsCategoriesGet GET /projects/categories Get default number of projects per category (Most downloaded etc.)
ProjectsApiInterface projectsExtensionsGet GET /projects/extensions Get all possible project extensions. Extensions are automatically added to projects based on their bricks.
ProjectsApiInterface projectsFeaturedGet GET /projects/featured Get the currently featured projects
ProjectsApiInterface projectsGet GET /projects Get projects
ProjectsApiInterface projectsPost POST /projects Upload a catrobat project
ProjectsApiInterface projectsSearchGet GET /projects/search Search for projects associated with a keywords
ProjectsApiInterface projectsTagsGet GET /projects/tags Get all possible project tags. Some Tags will only be availabe during events.
ProjectsApiInterface projectsUserGet GET /projects/user Get the projects of the logged in user
ProjectsApiInterface projectsUserIdGet GET /projects/user/{id} Get the public projects of a given user
SearchApiInterface searchGet GET /search Search for projects, users,..
UserApiInterface userDelete DELETE /user Delete user account
UserApiInterface userGet GET /user Get your private user data
UserApiInterface userIdGet GET /user/{id} Get public user data
UserApiInterface userPost POST /user Register
UserApiInterface userPut PUT /user Update User
UserApiInterface userResetPasswordPost POST /user/reset-password Request email to reset password
UserApiInterface usersGet GET /users Get users
UserApiInterface usersSearchGet GET /users/search Search for users
UtilityApiInterface healthGet GET /health Health Check
UtilityApiInterface surveyLangCodeGet GET /survey/{lang_code} Get survey link for given language code.

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

BearerAuth

  • Type: HTTP Bearer Token authentication (JWT)

Author

webmaster@catrobat.org