{"id":86,"date":"2024-04-23T11:46:08","date_gmt":"2024-04-23T11:46:08","guid":{"rendered":"https:\/\/wp-multilang.com\/docs\/?post_type=ht_kb&#038;p=86"},"modified":"2025-12-01T06:32:23","modified_gmt":"2025-12-01T06:32:23","slug":"how-to-use-rest-api-requests-to-specify-language-preferences-in-wp-multilang","status":"publish","type":"ht_kb","link":"https:\/\/wp-multilang.com\/docs\/knowledge-base\/how-to-use-rest-api-requests-to-specify-language-preferences-in-wp-multilang\/","title":{"rendered":"How to Use REST API Requests to Specify Language Preferences in WP-Multilang"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Let&#8217;s explore the functionality of this plugin with REST API:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">i. <strong>Compatibility with REST-API:<\/strong>  The &#8220;<strong>WP-Multilang<\/strong> &#8221; Plugin seamlessly integrates with existing applications and systems, adhering to <strong>REST-API<\/strong> standards.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ii. <strong>Language Customization: <\/strong>Users can define their preferred translation language using the &#8216;lang&#8217;         parameter in the GET request to the REST endpoint, enabling them to receive information in their chosen language.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">iii. <strong>Flexible Language Settings:<\/strong> The system supports persistent transmission of the &#8216;lang&#8217; parameter in subsequent requests, allowing users to maintain their language preference for a personalized experience across interactions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By simply passing the &#8216;<strong>lang<\/strong>&#8216; parameter, users can retrieve desired information. For instance, &#8216;<strong>wp-json\/wp\/v2\/posts\/?lang=hi<\/strong>&#8216; appended to your URL.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s an example URL: &#8216;<a href=\"https:\/\/xyz-host.com\/wp-json\/wp\/v2\/posts\/?lang=it\">https:\/\/xyz-host.com\/wp-json\/wp\/v2\/posts\/?lang=it<\/a>&#8216;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check the Output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"604\" src=\"https:\/\/wp-multilang.com\/docs\/wp-content\/uploads\/2024\/04\/download-5-1-1024x604.png\" alt=\"\" class=\"wp-image-87\" srcset=\"https:\/\/wp-multilang.com\/docs\/wp-content\/uploads\/2024\/04\/download-5-1-1024x604.png 1024w, https:\/\/wp-multilang.com\/docs\/wp-content\/uploads\/2024\/04\/download-5-1-300x177.png 300w, https:\/\/wp-multilang.com\/docs\/wp-content\/uploads\/2024\/04\/download-5-1-768x453.png 768w, https:\/\/wp-multilang.com\/docs\/wp-content\/uploads\/2024\/04\/download-5-1-50x29.png 50w, https:\/\/wp-multilang.com\/docs\/wp-content\/uploads\/2024\/04\/download-5-1-1536x906.png 1536w, https:\/\/wp-multilang.com\/docs\/wp-content\/uploads\/2024\/04\/download-5-1-2048x1208.png 2048w, https:\/\/wp-multilang.com\/docs\/wp-content\/uploads\/2024\/04\/download-5-1-60x35.png 60w, https:\/\/wp-multilang.com\/docs\/wp-content\/uploads\/2024\/04\/download-5-1-100x59.png 100w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, the user specifies <strong>Italian<\/strong> (&#8216;it&#8217;) as the desired language for the response. The system processes the request accordingly, returning the data in <strong>Italian<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These features enhance user experience and accessibility by delivering information in the user&#8217;s preferred language, leading to improved engagement and satisfaction.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s explore the functionality of this plugin with REST API: i. Compatibility with REST-API: The &#8220;WP-Multilang &#8221; Plugin seamlessly integrates with existing applications and systems, adhering to REST-API standards. ii. Language Customization: Users can define their preferred translation language using the &#8216;lang&#8217; parameter in the GET request to the REST&#8230;<\/p>\n","protected":false},"author":2,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[5],"ht-kb-tag":[],"class_list":["post-86","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-how-to"],"_links":{"self":[{"href":"https:\/\/wp-multilang.com\/docs\/wp-json\/wp\/v2\/ht-kb\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp-multilang.com\/docs\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/wp-multilang.com\/docs\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/wp-multilang.com\/docs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wp-multilang.com\/docs\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":2,"href":"https:\/\/wp-multilang.com\/docs\/wp-json\/wp\/v2\/ht-kb\/86\/revisions"}],"predecessor-version":[{"id":370,"href":"https:\/\/wp-multilang.com\/docs\/wp-json\/wp\/v2\/ht-kb\/86\/revisions\/370"}],"wp:attachment":[{"href":"https:\/\/wp-multilang.com\/docs\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/wp-multilang.com\/docs\/wp-json\/wp\/v2\/ht-kb-category?post=86"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/wp-multilang.com\/docs\/wp-json\/wp\/v2\/ht-kb-tag?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}