Showing results for 
Search instead for 
Did you mean: 

Magento 2 REST APIs / RestSharp - GET Limit


Magento 2 REST APIs / RestSharp - GET Limit

Hi all,


I am finally using RestSharp to access Magento 2 APIs.


With RestSharp, I am able to do things like seeing products, change order status, change product stocks... But I can't for example see all order lines containing a determinate product.


For this I think I have to use:


/V1/orders/items (GET)


but I don't Know how to pass a parameter to this query.


I have tried the following:


var client = new RestClient("[magento_URL]");
var request = new RestRequest("/rest/default/V1/orders/items", Method.GET);
string.Format("Bearer " + "[INTEGRATION_TOKEN]"),
 request.AddParameter("sku", "Product_SKU", ParameterType.UrlSegment);



and I get the response:

{"message":"%fieldName is a required field.","parameters":{"fieldName":"searchCriteria"}}


I have also tried replacing "ParameterType.UrlSegment" with "ParameterType.QueryString" with the same result.

If I try to get all order items (without the parameter line) I get the same result too...


What I would like to get is all order items with a concrete product sku.


Any help?? RestSharp works good but I can't do this...









[SOLVED]Re: Magento 2 REST APIs / RestSharp - GET Limit

Solved, FYI the right request code is:


 var request = new RestRequest("/rest/default/V1/orders/items/?searchCriteria[filterGroups][0][filters][0][field]=sku&searchCriteria[filterGroups][0][filters][0][value]=value&searchCriteria[filterGroups][0][filters][0][condition_type]=eq", Method.GET);


Where value contains the value to search.