Shopify API + restSharp - Anyone using it? Problem adding a product

Shopify API + restSharp - Anyone using it? Problem adding a product

hookbeak
Shopify Partner
15 1 6

I'm using restsharp to talk to the API, but having problems adding a product.

Here's some code which is working - this takes an fulfillment_id and marks the order complete

 

 

Dim api_path As String = "/admin/api/2022-04/orders/" & order_id & "/" & fulfillment_id & "/complete.json"
Dim api_request = New RestSharp.RestRequest(api_path, Method.POST)

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

 

 

 

so, i'd assumed adding a product would be similar

 

 

Dim api_path As String = "/admin/api/2022-04/products.json"
Dim api_request = New RestSharp.RestRequest(api_path, Method.POST)
api_request.AddParameter("title", "TEST")
api_request.AddParameter("body_html", "test product body")
api_request.AddParameter("status", "draft")
api_request.AddParameter("vendor", "TESTING")
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

 

 

 

however this gives me an error of : 

 

{"errors":{"product":"Required parameter missing or invalid"}}

 



Am i trying to add a product completely wrongly? or is there some other issue anyone can see?

thanks for any help.

Reply 1 (1)

hookbeak
Shopify Partner
15 1 6

UPDATE: i was sending the product data incorrectly - however i now have a new issue :

https://community.shopify.com/c/shopify-apis-and-sdks/api-invalid-api-key-or-access-token-unrecogniz...