Access Endpoint by C#

Access Endpoint of "Get Data by Barcode" which was created on example "Manage Item by Barcode by using Camera on Web Browser" by C#.

Create based on a sample code on Endpoint page

System.Uri requestURI = new System.Uri("https://dbaassandbox.matsuesoft.co.jp/?????/proxyserver-AssetInfo-GetSpecificAssetByBarcode.php");   <From here, copy from Template>
using (System.Net.Http.HttpClient httpClient = new System.Net.Http.HttpClient())
using (System.Net.Http.StringContent content = new System.Net.Http.StringContent("{"
    + "\"TOKEN\": \"?????\","
    + "\"param_AssetInfo_Barcode_where\": \"9784845623556\""             ← Specify Barcode to get data
    + "}"))
{
    var request = new System.Net.Http.HttpRequestMessage()
    {
        RequestUri = requestURI,
        Method = System.Net.Http.HttpMethod.Post,
        Content = content
    };
    httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
    httpClient.DefaultRequestHeaders.Host = requestURI.Host;
    using (System.Net.Http.HttpResponseMessage response = await httpClient.SendAsync(request))
    {
        if (response.IsSuccessStatusCode)
        {
            string resultContent = await response.Content.ReadAsStringAsync();

            Console.WriteLine(resultContent);
        }
    }
}      <Until here, copy from Template>

After execute, result will be displayed as below:

{"Result":{"Barcode":"9784845623556","ItemName":"DEF Travel Book","Description":"This is DEF..."},"_status":"OK","Message":"Successfully called"}

※In case of C#, additional code is requied to encode/decode JSON.
※Some class will be created by using Dropbox such as Client Access Class and JSON data class to encode/decode JSON and store data into C# class. See example "Example for C# Client" for more details.

Back to top

LoginLogin with this Site's User Name (ID)
Quick Login:Quick Login by Facebook ID (Keep Login Option:ON) / Newly Register


Inquiry

© 2016-2019 Matsuesoft Corporation