API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Connect example for the REST api and ASP.NET MVC

Hi.Does anyone have small example of REST request in asp.net mvc using token method.
created Jun 6, 2016 by Manoj
50% Accept Rate
Q 3 A 1 C 3

1 Answer

Something like this:
        string result = Get("https://restapi.e-conomic.com/customers");
If you have the following code:
        private string Get(string url)
            //Task.Run() necessary in order to avoid Deadlocks (http://stackoverflow.com/a/32429753)
            return Task.Run(() => GetAsync(url)).Result;
        private async Task<string> GetAsync(string url)
            using (var client = CreateClient())
                using (HttpResponseMessage response = await client.GetAsync(url))
                    string responseContent = await response.Content.ReadAsStringAsync();
                    return responseContent;
        private HttpClient CreateClient()
            var client = new HttpClient();
            client.DefaultRequestHeaders.Add("X-AppSecretToken", _appToken);
            client.DefaultRequestHeaders.Add("X-AgreementGrantToken", _token);
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            return client;
You could then deserialize it with e.g. Newtonsoft Json.
answered Jun 29, 2016 by NillDk
Hi Nill,
Thank you for your reply.
Actually i want to connect my nopcommerce website to e-conomic for storing user information , order generation ,invoice generation using api but i don't know how to do this

can you please help me.
Sorry, but I don't know anything about nopcommerce.

I just saw your post regarding a MVC REST example and hoped that I could bring you a step forward as I have recently worked with it :)
Sorry For that,
  But You have any connection string for transferring data from another webstore  to e-conomic(Like user information, order information)
Visma e-conomic A/S