Method | Request URI |
---|---|
POST | /API/Localization/GetString/ |
This example will get a localized string of for the engine module which has an ID = EC04F56F-AAD2-4395-BCB3-35F5B1D0C8F1. The string key for the localized value is "GS_EngineAlreadyStarted".
using System.Net; using System.Net.Http; using System.Runtime.Serialization; using System.Runtime.Serialization.Json; using System.Web.Script.Serialization; ... using (HttpClient httpClient = new HttpClient()) { string url = "http://localhost:8004/API/Localization/GetString/"; // Define the request body HttpContent requestBody = null; requestBody = new StringContent(@" { ""moduleId"": ""EC04F56F-AAD2-4395-BCB3-35F5B1D0C8F1"", ""key"": ""GS_EngineAlreadyStarted"" } ",Encoding.UTF8,"application/json"); using (var response = httpClient.PostAsync(url, requestBody).Result) { if(response.StatusCode == HttpStatusCode.OK) { Console.WriteLine("Success"); // The localized string for the key // GS_EngineAlreadyStarted" string jsonObject = response.Content.ReadAsStringAsync().Result; } } }
import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPut; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.apache.http.entity.StringEntity; import org.json.JSONObject; ... HttpClient httpClient = HttpClientBuilder.create().build(); String url = "http://localhost:8004"; String requestUrl = "http://localhost:8004/API/Localization/GetString/"; // Define the Request Method. HttpPost requstMethod = new HttpPost(requestUrl); // Define the Request Body. StringEntity input = new StringEntity( "{" + " \"moduleId\": \"EC04F56F-AAD2-4395-BCB3-35F5B1D0C8F1\"," + " \"key\": \"GS_EngineAlreadyStarted\" " + "}" ); input.setContentType("application/json"); requstMethod.setEntity(input); HttpResponse response = httpClient.execute(requstMethod); if(response.getStatusLine().getStatusCode() == 200) { System.out.println("Success"); } // The localized string for the key // GS_EngineAlreadyStarted" String json = EntityUtils.toString(response.getEntity());
var dataObject = { "moduleId": "EC04F56F-AAD2-4395-BCB3-35F5B1D0C8F1", "key": "GS_EngineAlreadyStarted" }; $.ajax({ type: "POST", url: baseUrl + "/API/Localization/GetString/", data: dataObject, success: function(data) { // data = The localized string for the key // GS_EngineAlreadyStarted" }, error: function(data) { alert('failed' + data); } });