Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
Hi, i'm trying to connect to te api usng c# to a demo site but i'm receiving error 401 not authorized.
I use this code and i need help to get the response OK.
Could you help me please?
public static void GETShopify(string CallLoc, string APIKey, string Password, string StoreName)
{
string Str = APIKey + ":" + Password;
byte[] byt = System.Text.Encoding.UTF8.GetBytes(Str);
Str = System.Convert.ToBase64String(byt);
string Url = "https://" + StoreName + ".myshopify.com/admin/" + CallLoc;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
WebRequest request = WebRequest.Create(Url);
WebResponse response = null;
NetworkCredential SimpleCredential = new NetworkCredential(APIKey, Password);
request.Credentials = SimpleCredential;
request.Headers.Add("Authorization", "Basic " + Str);
request.ContentType = "application/json";
request.Method = "GET";
try
{
response = (HttpWebResponse)request.GetResponse();
}
catch (Exception a)
{
Console.WriteLine(a.ToString());
}
}
Solved! Go to the solution
This is an accepted solution.
I find the solution in the site and not in the partner portal.
So in the site i have to enable private apps.
This is an accepted solution.
I find the solution in the site and not in the partner portal.
So in the site i have to enable private apps.
User | RANK |
---|---|
4 | |
4 | |
4 | |
3 | |
3 |