I’m using asp.net and restsharp to connect to the api.
The code i’m using can successfully get orders, products, complete orders, uncomplete orders and a lot of other functions.
However, i’m trying to add a product and getting the error: [API] Invalid API key or access token (unrecognized login or wrong password
Code here:
Public api_token = "APITOKENGOESHERE"
Public api_client = New RestSharp.RestClient("https://MYSTORE.myshopify.com")
Public base_api_path = "/admin/api/2022-04/"
Dim api_path As String = base_api_path & "products.json"
Dim api_request = New RestSharp.RestRequest(api_path, Method.POST)
Dim product = New Product()
product.Title = "TEST PRODUCT"
product.body_html = "body here"
product.vendor = "TESTING"
Dim json_object = JsonConvert.SerializeObject(product)
api_request.AddJsonBody(json_object)
api_request.AddParameter("access_token", api_token)
Dim api_response As New RestSharp.RestResponse
api_response = api_client.Execute(api_request)
Dim my_result_json = api_response.Content.ToString
The JSON generated seems fine, and i’m authenticating the same way i authenticate dozens of other api calls that all work fine. The header for the request is correctly showing as “application/json”.
Any ideas? do these requests authenticate in a completely different way to other requests?