PrestaSharp icon indicating copy to clipboard operation
PrestaSharp copied to clipboard

Supplier Orders

Open jmawebtech opened this issue 8 years ago • 2 comments

Hi,

I am trying to pull a list of supplier orders from PrestaShop, based on the date_add field. When I make the query, I get an error. Is this field filterable? Here is my URL:

https://xx.com/api/supply_orders?display=full&filter[date_add]=[2017-01-01 00:00:00,2017-01-31 00:00:00]&sort=id_DESC

This URL works:

https://xx.com/api/supply_orders/1

jmawebtech avatar Jan 25 '17 16:01 jmawebtech

It also needs this: request.AddParameter("date", "1"); Probably you have to add it on the link too (...orders/&date=1....)

DoubleDim avatar Feb 16 '17 08:02 DoubleDim

This code worked:

public List<Entities.supply_order> GetOrdersByDateRange(DateTime beginDate, DateTime endDate) { Dictionary<string, string> dtn = new Dictionary<string, string>(); //dtn.Add("date_add", MakeBrackets(beginDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd")) + "&date=1"); //RestRequest request = this.RequestForFilter("supply_orders", "full", dtn, null, null, "supply_orders"); var uri = String.Format("/supply_orders?display=full&filter[date_add]=>{0}&date=1", MakeBrackets(beginDate.ToString("yyyy-MM-dd HH:mm:ss"), endDate.ToString("yyyy-MM-dd HH:mm:ss"))); var request = new RestRequest(uri, Method.GET); return this.ExecuteForFilter<List<Entities.supply_order>>(request); }

jmawebtech avatar Feb 16 '17 16:02 jmawebtech