LangShop API
Developers documentation
Welcome to the LangShop API documentation!
On this page, you will find information for the developers of third-party apps. Here we provide examples in different programming languages on how to integrate LangShop API.
Note
Please, note that token provided in our examples it's a demo key. It's limited for requests. Your key won't be limited.
LangShop API is intended for the integration and translation of the custom content in your application. If you want to get translations of products, collections, articles, etc., please refer to the Shopify documentation . Our API is for the translation of custom text in your apps only.
After the integration we can offer you co-marketing. For example, we will place your logo with the link to your app on our Partners page. We can also cooperate in social networks and other areas in order to grow and develop together.
// Store domain to request translations
const domain = "langshop.myshopify.com";
// Application token, received from LangShop email request to support@langshop.app
const token = "8a2203211dbb8db4e7209cede045cbe7b0deffefd49e678a86872370ea866de0";
fetch("https://api.langshop.app/translate", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Basic " + btoa(domain + ":" + token)
},
body: JSON.stringify({
"to": "fr",
"query": [
{
"value": "Button label",
"key": "button.label" // Optional field
}
]
})
})
.then((response) => {
return response.json();
})
.then((result) => {
console.log(result.data.translations[0].value); // Will output "Étiquette du bouton"
});
// Store domain to request translations
$domain = "langshop.myshopify.com";
// Application token, received from LangShop email request to support@langshop.app
$token = "8a2203211dbb8db4e7209cede045cbe7b0deffefd49e678a86872370ea866de0";
$ch = curl_init("https://api.langshop.app/translate");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Accept: application/json"
]);
curl_setopt($ch, CURLOPT_USERPWD, $domain . ":" . $token);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"to" => "fr",
"query" => [
[
"value" => "Button label",
"key" => "button.label" // Optional field
]
]
]));
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
echo $result["data"]["translations"][0]["value"]; // Will output "Étiquette du bouton"
curl --location --request POST 'https://api.langshop.app/translate' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--user 'langshop.myshopify.com:8a2203211dbb8db4e7209cede045cbe7b0deffefd49e678a86872370ea866de0' \
--data-raw '{
"to": "fr",
"query": [
{
"value": "Button label",
"key": "button.label"
}
]
}'