cancel
Showing results for 
Search instead for 
Did you mean: 

salesRuleRuleRepositoryV1 does not work ¿? - "no such entity" in GET method

salesRuleRuleRepositoryV1 does not work ¿? - "no such entity" in GET method

Hello,

 

am developing an application using C# and RestSharp to integrate Magento 2 with an ERP using Magento 2 REST API.

 

I am trying to GET a Catalog Price Rule that I created in my Magento Site with id=1 .

 

I am using salesRuleRuleRepository - /V1/salesRules/{ruleId} (GET) to get it. I've seen it on:

 

http://devdocs.magento.com/swagger/index_20.html#/

 

I have tried an easy code to retrieve it (this code works good in other GET methods). My code is:

 

--

var client = new RestClient(magento_server);

// Llamada a GET salesOrderRepositoryV1 (V1/orders/{id})
var request = new RestRequest("/rest/default/V1/salesRules/{ruleId}", Method.GET);
request.AddParameter("Authorization",
string.Format("Bearer " + magento_auth),
ParameterType.HttpHeader);
request.AddUrlSegment("ruleId", "1");

IRestResponse response = client.Execute(request);
var content = response.Content;
MessageBox.Show("Reponse: " + content);

--

 

I get a "no such entity" as response. I don't know why...

Anyone can help me? Does this method really work?? I have also tried to search with parameters on /V1/salesRules/search with no luck. Or should I use other method??

 

Any help will be appreciated.

 

Thanks a lot!

1 REPLY 1

Re: salesRuleRuleRepositoryV1 does not work ¿? - "no such entity" in GET method

Finally found the reason... salesRuleRuleRepository is ONLY for Cart Price Rules, not for Catalog Rules...