[DOCU-1390] Delivery endpoint: how to filter on specific languages Created: 27/Mar/18 Updated: 23/Jul/18 Resolved: 20/Jul/18 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Christopher Zimmermann | Assignee: | Martin Drápela |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
When you provide a string in a filter - the endpoint will only return items where the english result matches. This should be documented, and how to filter on another language should be documented ie "How to filter on a specific language". For example if I filter on the tours with ?body[like]=%25einmalig%25 I will get no results. To filter on a foreign language I must filter on ?body_de[like]=%25einmalig%25, and then I will get the Tiger beach tour. https://demo.magnolia-cms.com/.rest/delivery/tours/v1?body_de[like]=%25einmalig%25
(See https://jira.magnolia-cms.com/browse/MGNLREST-181 for extended discussion) (cc mgeljic) |
| Comments |
| Comment by Martin Drápela [ 18/Jul/18 ] |
|
A nice ticket - thx for it czimmermann - resulting in a seemingly "simple" doc change it actually points again to a more general question of de-i18nizing the property names in REST responses (except in the case of adding "lang=all"). As a user I may not be aware of which language content is the default for a given site and so while - staying in the language-specifying mood for a while - the following https://demo.magnolia-cms.com/.rest/delivery/tours/v1?body_de[like]=%25einmalige%25 does produce a result (actually two entries), an analogy in English https://demo.magnolia-cms.com/.rest/delivery/tours/v1?body_en[like]=%25once-in-a-lifetime%25 produces nothing. In order to get the English content you need to remove the _en locale suffix: https://demo.magnolia-cms.com/.rest/delivery/tours/v1?body[like]=%25once-in-a-lifetime%25 and only then you get: {
"results":[
{
"@name": "Last-Bike-out-of-Hanoi",
"@path": "/magnolia-travels/Last-Bike-out-of-Hanoi",
"@id": "4d0b919a-99d3-469e-95d9-491f83eaab2c",
"@nodeType": "mgnl:content",
"isFeatured": "true",
"name": "Last Bike out of Hanoi",
"description": "Roam Vietnam's northern province on a trusty Minsk motorcycle",
"location": "Hanoi, Vietnam",
"tourTypes":[{"@name": "offPath", "@path": "/tour-types/offPath",…],
"author": "Magnolia Travels",
"body": "<p>Hà Giang, Vietnam's northern province, is an enchanting landscape of misty mountains and winding backroads. Roam this far-flung corner of civilization on a trusty Minsk motorcycle, the mule of the mountains. Reliable, simple and ideally suited for harsh mountain roads, the Minsk enjoys a cult following in Vietnam. Like the bike, our weathered guide Quyền is a native of Hà Giang.</p>\n<p>A week-long motorbike roadtrip in North Vietnam is a once-in-a-lifetime experience. Movement takes over the consciousness as you ride through emerald green valleys and past centuries-old rice terraces, into a different state of mind.</p>\n<p>Stark cliffs cut through the gray sky. Pouring rain turns the road into a glorious soup. The bike plows through the cappuccino-colored substance effortlessly on wide knobby tyres. Until it no longer does. A water buffalo watches as you push your bike through the mud. After a day you tend to forget about the weather, focusing instead on staying on the road that seems too narrow for any vehicle. You wonder how the local truck drivers manage to keep keep from falling into the ravine as you struggle to keep even two wheels on the pavement.</p>\n<p>Lunch break at a village market. The chicken you nearly hit on the way in now enriches the steaming bowl of pho. Scents of lemongrass and coriander fill your brain. The smiling host added too much chili but you don't mind. The pho warms your core, a welcome feeling after the rain. This beautiful backwater of the world gets few visitors and you begin to understand why.</p>\n<p>Accommodation in North Vietnam is affordable and easy to find. Lodging here is all-inclusive in the Buddhist sense: everything you need but nothing you want. Wood fire to keep you dry, peace of mind, good night sleep.</p>\n<p>Magnolia Travels organizes week-long motorcycle tours in Hà Giang six times a year. Book your adventure now.</p> ",
"destination":[{"@name": "asia", "@path": "/destinations/asia",…],
"duration": "7",
"image":{"@name": "flickr_hanoi_motorbike_by20_Khanh_Hmoong_15358008654_4081834552_k.jpg", "@path": "/tours/flickr_hanoi_motorbike_by20_Khanh_Hmoong_15358008654_4081834552_k.jpg",…},
"@nodes":[]
}
]
}
(Thinking about a convenient way to describe this in the DOCS.) |
| Comment by Christoph Meier [ 20/Jul/18 ] |
|
mdrapela - 2 comments / things I would change:
|
| Comment by Martin Drápela [ 23/Jul/18 ] |
|
ep point added, as well as the general q= search hint, copied to DOCS56. |