我曾尝试使用此类请求检索Woocommerce商店的所有产品,但我只获得10种产品:
<div class="container">
<h2><%= pagetitle %> </h2>
<form method="post" action="/events/edit">
<div class="container">
<div class="col-md-12 ">
<div class="row">
<div class="col-md-12 ">
<input class="form-control" type="text" name="title" id="title" value="<%= title %>" placeholder="Titlu Eveniment" required="true">
<p style="color:#8B0000;"><small>*This field is mandatory</small></p>
<textarea rows=7 class="form-control" type="text" name="description" id="description" placeholder="Descriere Eveniment"><%= description %></textarea> <br>
<input class="form-control" type="text" name="availabletickets" id="availabletickets" value="<%= availabletickets %>"> <br>
<label> Data:<%= newdate %> </label> <br/>
<label>Cahnge event date:</label>
<input class="form-control" type="date" name="date" id="date" style="width:190px;" ><br>
<button class="btn" id="addValue" style="background-color:#8B0000; color:white;">Save</button>
<button class="btn btn-warning">Cancel</button>
</div>
</div>
</div>
</div>
</form>
</div>
我找到的唯一解决方案是在请求中添加过滤器以获取特定数量的产品,例如:http://www.mystore.com/wc-api/v3/products?oauth_consumer_key=ck_1234&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1488898708&oauth_nonce=a83kF3&oauth_signature=whatever
。这很好但问题是我需要一个通用的解决方案,因为现在我想从多个商店获得产品,其中一些可以拥有数千种产品。
有没有更好的方法来获取商店的所有产品而不设置限制?
答案 0 :(得分:0)
好的,似乎-1正在完成这项工作:&filter[limit]=-1
或filter%5Blimit%5D=-1
我会添加一个提示,以防有人在同样的情况下结束......
如果您需要使用Java进行API调用,请确保将上述过滤器与其余授权参数一起加密,以获得oauth签名。