Welcome to the P-Platform API made with API-Platform.
As for any P-Project application, all dependencies, installation and run scripts are listed in the .p-properties.yml file.
If you want to use P-API default settings, you can create a postgres user
with a postgres password:
sudo su - postgres
psql template1
template1=# CREATE USER postgres WITH PASSWORD 'postgres';
If postgres already exist :
template1=# ALTER USER postgres PASSWORD 'postgres';
template1=# GRANT ALL PRIVILEGES ON DATABASE "api" to postgres;
template1=# \q
Commands are listed in the run section of the
.p-properties.yml file.
Fill in the app/config/parameters.yml with the following values:
parameters:
database_host: db
database_port: 5432
database_name: p-api
database_user: postgres
database_password: postgres
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
secret: ThisTokenIsNotSoSecretChangeIt
cors_allow_origin:
- 'http://localhost:3000'
- 'http://localhost:9080'Build the image:
docker-compose buildRun the docker-compose:
docker-compose -d upBefore being able to request the API, you must authenticate through the oAuth server.
To do so in development mode, you must authenticate using the following url:
/oauth/v2/token?client_id=1_client_id&client_secret=client_secret&grant_type=password&redirect_uri=127.0.0.1&username=michel&password=password
You will be authenticated as michel (ask the API if you need more information
about this user).
In the Json response, you should get and use the attribute access_token. Put
it in the header of your next requests by adding an attribute Authorization
with the value Bearer followed with the access_token.
For example :
Bearer OWQ3ZGYzZmVhZDcxNTRmNDAwZGE3YjhjZWI1MmIwOWY1YzIzY2FmYjA0MmYxMGUwZDY5N2RiZTQ5NWM1NDA2Mw
