GithubHelp home page GithubHelp logo

toujou-api's Introduction

Toujou API

REST API for TYPO3 CMS based on {json:api}

Useful german youtube video https://www.youtube.com/watch?v=WoOuNe_rzpM

Installation

Require and install the plugin

$ composer require dfau/toujou-api
$ vendor/bin/typo3cms extension:install toujou_api 

Configuration

To make the API work you have to do the following:

  • Check Sites Management for api entrypoint
  • Create a BE user with OAuth2 client_id and client_secrect (OAuth2 tab)
  • Add and configure API resources (see Resources.php)
  • Add and configure API routes (see Resources.php)

Security

The API will be secured to prevent unwarranted requests.

You can obtain an access token by sending a POST request to /_api/token with following parameters:

key value
grant_type client_credentials
client_id <CLIENT_ID>
client_secret <CLIENT_SECRET>

Get auth token via request (Example):

curl --location --request POST 'https://rms.dfau.dev/_api/token' \
    --form 'grant_type="client_credentials"' \
    --form 'client_id="12fc7d65-0177-48be-9c3c-e7d8b2a1"' \
    --form 'client_secret="131"'

On valid credentials the json response will contain an access token:

{
  "token_type": "Bearer",
  "expires_in": 86400,
  "access_token": "eyJ0eXAiOiJ..."
}

For all following requests you need to use this access token by adding following line to the request header

Authorization : Bearer <ACCESS_TOKEN>

Example requests:

curl --location --request GET 'https://rms.dfau.dev/_api/pages/' \
    --header 'Authorization: Bearer eyJ0eXAi....' \

Development

Install php dependencies using composer:

$ composer install

PHPUnit Unit tests

$ etc/scripts/runTests.sh

PHPUnit Functional tests

$ etc/scripts/runTests.sh -s functional

Codeception Acceptance tests

$ etc/scripts/runTests.sh -s acceptance

Check coding standard violations

$ etc/scripts/checkCodingStandards.sh

Fix coding standard violations automatically

$ etc/scripts/checkCodingStandards.sh --fix

Documentation

Make `dockrun_t3rd available in current terminal

source <(docker run --rm t3docs/render-documentation show-shell-commands)

Run dockrun_t3rd

dockrun_t3rd makehtml

Open documentation

open "Documentation-GENERATED-temp/Result/project/0.0.0/Index.html"

toujou-api's People

Contributors

twojtylak avatar tmaroschik avatar helsner avatar dominikdoerr avatar dependabot[bot] avatar

Stargazers

Markus Mächler avatar Ralf Freit avatar Artus Kolanowski avatar Josef Glatz avatar Daniel Huf avatar

Watchers

 avatar James Cloos avatar Artus Kolanowski avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.