Reputation: 390
I need to create a Hybris customer sync application with an external system.
I'm trying to pull only customers that have been modified after a specific date-time but not having any luck.
Looking at the Hybris documentation it indicates that something like this should work but it doesn't work:
It just returns all of the customers.
I've tried all kinds of variations of date format, etc.
Anyone have an example of how to create the query using the HYBRIS REST API?
Upvotes: 2
Views: 1614
Reputation: 390
Found it. Had the wrong resource (customers - not customer) and had to do a conversion on the date (or at least that works).
Here is by date only:
http://tphybris-vm:9001/ws410/rest/customers?customers_size=50&customer_attributes=modifiedtime&customers_query=%7Bmodifiedtime%7D%20%3E%20TO_TIMESTAMP('2016-10-21'%2C%20'YYYY-MM-DD')
Returns:
{
"@uri" : "http://tphybris-vm:9001/ws410/rest/customers?customers_size=50&customer_attributes=modifiedtime&customers_query=%7Bmodifiedtime%7D%20%3E%20TO_TIMESTAMP('2016-10-21'%2C%20'YYYY-MM-DD')",
"customer" : {
"@uri" : "http://tphybris-vm:9001/ws410/rest/customers/anonymous",
"modifiedtime" : "2016-10-21T10:30:01.099-07:00",
"authorizedToUnlockPages" : "false",
"loginDisabled" : "false"
}
}
Here is by date time:
http://tphybris-vm:9001/ws410/rest/customers?customers_size=50&customer_attributes=modifiedtime&customers_query=%7Bmodifiedtime%7D%20%3E%20TO_TIMESTAMP('2016-10-21%2010%3A30%3A00'%2C%20'YYYY-MM-DD%20HH%3AMI%3ASS')
Returns:
{
"@uri" : "http://tphybris-vm:9001/ws410/rest/customers?customers_size=50&customer_attributes=modifiedtime&customers_query=%7Bmodifiedtime%7D%20%3E%20TO_TIMESTAMP('2016-10-21%2010%3A30%3A00'%2C%20'YYYY-MM-DD%20HH%3AMI%3ASS')",
"customer" : {
"@uri" : "http://tphybris-vm:9001/ws410/rest/customers/anonymous",
"modifiedtime" : "2016-10-21T10:30:01.099-07:00",
"authorizedToUnlockPages" : "false",
"loginDisabled" : "false"
}
}
Upvotes: 2