Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am sending request to an API but in response I am getting this JSON payload:
{"status":{"code":450,"message":null},"response":null}

Using browser that API works fine but with xmlhttprequest using C# its returning error. Can anyone help me understand if an API returning data on a browser but not with programming what could be the reasons.
Thanks in advance.
Here is URL "https://www.atea.dk/eshop/products/skaerme-og-projektorer/skaerme/"
string API = "https://www.atea.dk/eshop/nodeapi/get-products";
string json = new JavaScriptSerializer().Serialize(new
{
    nextPage = 2,
    url = "https://www.atea.dk/eshop/products/skaerme-og-projektorer/skaerme/"
};
using (var client = new WebClient())
{
    client.Headers.Add("Content-Type", "application/json");
    string result = client.UploadString(API, "POST", json);
}


What I have tried:

I have tried everything the best of my knowledge but seems that some headers from this API which I am missing. I am thankful if any help I can get.
Posted
Updated 27-May-18 20:44pm
v3
Comments
F-ES Sitecore 25-May-18 4:36am    
If 450 is an http code then that means "Blocked by parental controls". Anyway, use a tool like Fiddler to examine the call when it is made by the browser vs the call when it is made by your code. Chances are the browser is adding a lot more header information and you need to work out which header is missing from your code. It might be as simple as the user agent, the accept type and so on. You won't know until you look.
NOOSL 25-May-18 7:16am    
I have tried again but no luck. Could you please help me here.
F-ES Sitecore 25-May-18 7:28am    
I can't access your system, I can't analyse the traffic to see how the two calls are different. Update your original question with the full request details of both calls and maybe someone can spot an important difference.
NOOSL 28-May-18 3:57am    
Here is URL "https://www.atea.dk/eshop/products/skaerme-og-projektorer/skaerme/"
If you can help to find headers the browser is sending to the server and then I can compare with header I am sending in my requests i.e.
nextPage = 2,
url = "https://www.atea.dk/eshop/products/skaerme-og-projektorer/skaerme/"
Richard MacCutchan 28-May-18 3:49am    
I just tried the API call and it returns error code 449. You need to contact the owners of the website for assistance.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900