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

We assume you are familiar with cURL . Note that cURL requires URL encoding.

See tools to test REST requests for other possibilities.

    • Find webpages in the Travel Demo which were last modified before or on June 12, 2015: 

      curl 'http://localhost:8080/magnoliaAuthor/.rest/delivery/ep/?mgnl:lastModified[lte]=2015-06-12' --globoff
      (info) By using the option --globoff you can specify URLs that contain the letters {}[] without having them being interpreted by cURL itself.

       Click to see the endpoint configuration and the resulting JSON

      Endpoint: ep

      class: info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpointDefinition
      workspace: website
      bypassWorkspaceAcls: true
      rootPath: /
      nodeTypes:
       - mgnl:page
      includeSystemProperties: true

      Response

      {
          "results": [
              {
                  "@name": "meta",
                  "@path": "/travel/meta",
                  "@id": "7ebd74f1-c6f7-4307-9953-afd549118a56",
                  "@nodeType": "mgnl:page",
                  "jcr:createdBy": "admin",
                  "hideInNav": "true",
                  "mgnl:template": "travel-demo:pages/standard",
                  "mgnl:lastActivatedBy": "superuser",
                  "jcr:created": "2019-09-25T08:49:30.320+02:00",
                  "mgnl:lastActivated": "2019-09-25T08:49:35.482+02:00",
                  "mgnl:created": "2015-02-02T20:58:23.939+01:00",
                  "mgnl:createdBy": "superuser",
                  "title": "Container for meta pages",
                  "mgnl:lastModified": "2015-06-03T20:37:49.283+02:00",
                  "mgnl:activationStatus": "true",
                  "mgnl:lastModifiedBy": "superuser",
                  "@nodes": [
                  ]
              }
          ]
      }

    • Find webpages with the word "Customer" in the title.

      curl -g -G "http://localhost:8080/magnoliaAuthor/.rest/delivery/ep" --data-urlencode "title[like]=%Customer%"
      Use --data-urlencode and -g -G to encode the request parameter values, if required.

       Click to see the endpoint configuration and the resulting JSON

      Endpoint: ep

      class: info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpointDefinition
      workspace: website
      bypassWorkspaceAcls: true
      rootPath: /
      nodeTypes:
       - mgnl:page

      Response

      {
          "results": [
              {
                  "@name": "customer-experience-agent",
                  "@path": "/travel/about/careers/customer-experience-agent",
                  "@id": "1f8af166-258f-4351-a543-3d0fc8bb00c0",
                  "@nodeType": "mgnl:page",
                  "hideInNav": "false",
                  "title": "Customer Experience Agent",
                  "@nodes": [
                  ]
              },
              {
                  "@name": "customer-experience-supervisor",
                  "@path": "/travel/about/careers/customer-experience-supervisor",
                  "@id": "c8e6902a-499a-44d7-9de9-45fd93d60a6b",
                  "@nodeType": "mgnl:page",
                  "hideInNav": "false",
                  "title": "Customer Experience Supervisor",
                  "@nodes": [
                  ]
              }
          ]
      }

      Due to the use of a wildcard character in the URL with the [like] filter the number of results can potentially be higher.

    • In the website workspace, find all nodes for which /travel/about/careers is the ancestor:

      curl 'http://localhost:8080/magnoliaAuthor/.rest/delivery/ep/?@ancestor=/travel/about/careers'
       Click to see the endpoint configuration and the resulting JSON

      Endpoint: ep

      class: info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpointDefinition
      workspace: website
      bypassWorkspaceAcls: true
      rootPath: /
      nodeTypes:
       - mgnl:page

      Response

      {
          "results": [
              {
                  "@name": "customer-experience-agent",
                  "@path": "/travel/about/careers/customer-experience-agent",
                  "@id": "1f8af166-258f-4351-a543-3d0fc8bb00c0",
                  "@nodeType": "mgnl:page",
                  "hideInNav": "false",
                  "title": "Customer Experience Agent",
                  "@nodes": [
                  ]
              },
              {
                  "@name": "marketing-associate",
                  "@path": "/travel/about/careers/marketing-associate",
                  "@id": "f19c60f2-3049-4883-a170-4bf65e3abb91",
                  "@nodeType": "mgnl:page",
                  "hideInNav": "false",
                  "title": "Marketing Associate",
                  "@nodes": [
                  ]
              },
              {
                  "@name": "customer-experience-supervisor",
                  "@path": "/travel/about/careers/customer-experience-supervisor",
                  "@id": "c8e6902a-499a-44d7-9de9-45fd93d60a6b",
                  "@nodeType": "mgnl:page",
                  "hideInNav": "false",
                  "title": "Customer Experience Supervisor",
                  "@nodes": [
                  ]
              }
          ]
      }

    • Find nodes in the tours workspace that contain the keyword "beach". Return the results in descending order based on the location property and restrict the number of results to two:

      curl 'http://localhost:8080/magnoliaAuthor/.rest/delivery/ep/?q=beach&orderBy=location%20desc&limit=2'

       Click to see the endpoint configuration and the resulting JSON

      Endpoint: ep

      class: info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpointDefinition
      workspace: tours
      bypassWorkspaceAcls: true

      Response

      {
          "results": [
              {
                  "@name": "Beach-Paradise-in-Brazil",
                  "@path": "/magnolia-travels/Beach-Paradise-in-Brazil",
                  "@id": "545d5815-a3dd-4b68-a539-c38eb1bba29b",
                  "@nodeType": "mgnl:content",
                  "isFeatured": "true",
                  "name": "Beach Paradise in Brazil",
                  "description": "An Amazonian beach holiday",
                  "location": "São Luís, Brasil",
                  "tourTypes": [
                      "082c340c-b062-4b15-86b8-96dd9deff680"
                  ],
                  "author": "Magnolia Travels",
                  "body": "<p>When you hear “Amazon”, you probably think of a deep jungle. Well, this remarkably well hidden beach paradise is right in the middle of it.  Alter do Chão lies on Rio Tapajós, a tributary to the mighty Amazon, which is so wide here that you can’t even see across to the far shore.  There’s plenty of nature to explore in the area on foot, but the inlet to the lake is also covered with cosy beach restaurants and bars, perfect for a post swim chill out.  </p>\n<p>No fear of crocodiles here, but there are some sting rays to watch out for.  You’ll start your adventure on the two-day boat ride from Manaus (capital of the Amazon) to Santarém, but be sure to bring your own hammock (and some rope) or just some extra coins for the bar!</p>\n<p>While you’re here, you’ll discover there’s much more to do than hanging out at the glorious beaches. The town lies at the entrance to the Lago Verde lagoon, home to many Amazon animals, and the perfect place to do a canoe trip. We also include tours to the beautiful Floresta Nacional do Tapajós and Rio Arapiuns.</p> ",
                  "destination": [
                      "bed2e297-199c-4dc8-90cd-54ad3cb4221b"
                  ],
                  "duration": "14",
                  "image": "jcr:950cc73c-1b12-4f2a-bba7-97ad9d171f5d",
                  "@nodes": [
                  ]
              },
              {
                  "@name": "West-Coast---Highway-101",
                  "@path": "/magnolia-travels/West-Coast---Highway-101",
                  "@id": "730c8850-d638-4e91-b3fb-4041a0c59ffe",
                  "@nodeType": "mgnl:content",
                  "name": "West Coast - Highway 101",
                  "description": "Family travels in USA",
                  "location": "Seattle, USA",
                  "tourTypes": [
                      "17da160b-da66-4e09-9e31-5fd040880f4a"
                  ],
                  "author": "Magnolia Travels",
                  "body": "<p>Imagine walking in the footsteps of the explorers, missionaries, and soldiers who made America what it is today. Discover the famous El Camino Real (The Royal Road) based on the old trail which linked the Spanish Missions, Pueblos and Presidios.</p>\n<p>We'll kick off in Seattle and head south into Oregon and finally to California where we'll hit the beaches on California Highway 1. The trip will be infused with history and fabulous scenery, but there’ll be lots of time for fun, with some great beach activities at the end of the trip.</p> ",
                  "destination": [
                      "ed3dcd18-78af-46df-a9e1-bc732479f2e7"
                  ],
                  "duration": "7",
                  "image": "jcr:d44f783c-91ca-4b48-9533-ea4e147e13e9",
                  "@nodes": [
                  ]
              }
          ]
      }

    • Find a tour with the word "Japan" in its description. Return only the variant in the German language:

      curl -g -G 'http://localhost:8080/magnoliaAuthor/.rest/delivery/ep?lang=de-DE' --data-urlencode "description[like]=%Japan%"

      Note that we use --data-urlencode to encode one of the request parameters, whereas the one that does not require encoding is added to the URL directly.

       Click to see the endpoint configuration and the resulting JSON

      Endpoint: ep

      class: info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpointDefinition
      workspace: tours
      bypassWorkspaceAcls: true

      Response

      {
          "results": [
              {
                  "@name": "Kyoto",
                  "@path": "/magnolia-travels/Kyoto",
                  "@id": "b475f27e-2929-427b-9517-815118a3b36e",
                  "@nodeType": "mgnl:content",
                  "name": "Kyoto",
                  "description": "Die natürliche Seite Japans",
                  "location": "Kyoto, Japan",
                  "tourTypes": [
                      "d2245867-ecaa-4b4e-8743-e0c939be68b7",
                      "415025c6-e4b5-4506-9384-34f428a52104"
                  ],
                  "author": "Magnolia Travels",
                  "body": "<p>Erleben Sie die Schönheit, die Kyoto durchdringt und umgibt. Kyoto ist berühmt für viele Dinge, darunter unzählige <a href=\"http://www.japan-guide.com/e/e2058.html\" target=\"_blank\">Tempel</a>, <a href=\"http://www.japan-guide.com/e/e2059.html\" target=\"_blank\">Schreine</a> und andere faszinierende historische Bauwerke.</p>\n<p>Kommen Sie mit uns auf einen Besuch der Stadt der zehntausend Schreine. Wir besuchen To-ji, Ginkaku-ji, Kōzan-ji und ihre bemerkenswerten Gärten, bevor wir einen Abstecher zu den Bergen in der Umgebung der Stadt machen. Sie werden es genießen, einen Tag im grünen Miyama und einen Tag mit Wandern in Shizuhara zu verbringen. Sie werden nie wieder wie bisher über Japan denken.</p> ",
                  "destination": [
                      "7ec72c48-c33f-418e-b2ff-44cfb4bbb1f2"
                  ],
                  "duration": "7",
                  "image": "jcr:44689d29-5966-4d41-8fd4-2dc7da783528",
                  "@nodes": [
                  ]
              }
          ]
      }


  • No labels