Page tree
Skip to end of metadata
Go to start of metadata

After installing and configuring, we will check content is properly served as JSON from both REST endpoints and the /json page node.

Testing the REST endpoints

To test the endpoints we use swagger tools which are included in Magnolia in the REST Tools module. 

=> http://localhost:8080/magnoliaAuthor/.magnolia/admincentral#app:restTools:;

Test nodes endpoint - The nodes API v.1

Example:

(blue star) Figure out the parameters to add to get the list of all makers or all cameras on the nodes API.

Test the custom endpoint - The camera collection API v.1

makers

Resource/cameracollection/v1/makers{makerPath:(/.+)?} 
parametersmakerPath/Rollei

makerById

Resource/cameracollection/v1/makerById/{uuid} 
parametersuuid723040c9-2f1b-4d88-8569-bbd9a57277cc

allMakers

Resource

/cameracollection/v1/allCameras

 
parameters--

cameras

Resource/cameracollection/v1/cameras{cameraPath:(/.+)?}  
parameterscameraPath/F3 

cameraById

Resource/cameracollection/v1/cameraById/{uuid} 
parametersuuid7e0940e1-9ac0-47e9-af45-52cbd2559a1a

allCameras

Resource

/cameracollection/v1/allCameras

 
parameters--

Testing the template-based JSON "provider"

Testing the JSON "providers" with cURL

cURL is always an alternative to test both the real REST endpoints and the template-based JSON providers. However, it requires that you have cURL installed.

Example on nodes endpoint

curl -H "Accept: application/json"  http://localhost:8080/magnoliaAuthor/.rest/nodes/v1/cameracollection/cameras/F3 -u superuser:superuser

Example on cameracollection endpoint

curl -H "Accept: application/json"  http://localhost:8080/magnoliaAuthor/.rest/cameracollection/v1/allCameras -u superuser:superuser

Example on template / virtualUri / /json

curl -H "Accept: application/json"  http://localhost:8080/magnoliaAuthor/json/cameras/F3 -u superuser:superuser 

  • No labels