Comments (3)
I get the same problem as well. Calling the woo-commerce endpoint via CURL is fine, for example:
curl "https://www.mysite.com/wp-json/wc/v2/orders?after=2021-01-01T00:00:00.000Z&before=2021-01-20T00:00:00.000Z" -u key:secret;
Furthermore, using this parameters is working like a charm as well:
// params.put("after", "2021-02-01T00:00:00.000Z");
// params.put("before", "2021-02-13T00:00:00:000Z");
params.put("context", "view");
params.put("per_page", "20");
params.put("page", "1");
params.put("status", "any");
params.put("orderby", "title");
Only when we uncomment one of before
or after
, then we get the exception described in this issue. Maybe there's little things that missing here.
@omandryk (sorry for mentioned you here), but do you have any idea what's going on?
from wc-api-java.
Issue Fixed. Got the solution we need to encode the dates.
String wcFormattedDate=startDate+"T00:00:00";
Map<String, String> params = new HashMap<>();
params.put("per_page", "10");
params.put("after", percentEncode(wcFormattedDate));
public String percentEncode(String s) {
final String UTF_8 = "UTF-8";
try {
return URLEncoder.encode(s, UTF_8)
// OAuth encodes some characters differently:
.replace(SpecialSymbol.PLUS.getPlain(), SpecialSymbol.PLUS.getEncoded())
.replace(SpecialSymbol.STAR.getPlain(), SpecialSymbol.STAR.getEncoded())
.replace(SpecialSymbol.TILDE.getEncoded(), SpecialSymbol.TILDE.getPlain());
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
from wc-api-java.
@kiranuw I think this issue should not closed yet, as currently there's PR from me about this issue.
from wc-api-java.
Related Issues (20)
- PKIX path building failed. Unable to find valid certification path to requested target HOT 3
- Update of order line_items HOT 1
- Apply coupon compatibly v3 HOT 2
- get product > 100 HOT 3
- 401 invalid signature when doing a GET with "after" or "before" as parameter HOT 11
- New Release HOT 2
- woocommerce get products gets only first 100. HOT 3
- Cannot pass object as perm to map. HOT 1
- update method is not working in product case
- Send image
- unable to update product using update method
- Update Store Purchase in Online Woocommerce Store.
- I want to know where can i get the request url
- Passing categories and attributes
- Logfactory bug
- how to pass arrays e.g images categories e.t.c HOT 1
- Creating Orders
- Is this save for production due to http? HOT 1
- Receiving an HTTP 406 Not Acceptable HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wc-api-java.