This page explains the Attraqt Fredhopper Query API.
Background
The Query API is the way to send requests to an Attraqt Fredhopper Service like e.g. Give me all red t-shirt for less than 50 EUR.
URL
Attraqt Fredhopper Managed Services provides query access at query.<configuration state>.<service instance>.<service>.<region>.fredhopperservices.com.
The Query API supports SOAP and REST/XML access:
Authentication is done via HTTP Basic Access Authentication. See the Frontend Integration Tutorial for an example of sending credentials with Java/JAX-WS.
| Fredhopper supports query access via HTTP and via HTTPS protocol. Please keep in mind that HTTPS adds an additional 50-100ms latency to each query. For example: if a HTTP roundtrip takes 400ms, then the same roundtrip via HTTPS would take 450-500ms. |
Compression
Attraqt Fredhopper's Query API supports HTTP compression of the responses. We strongly advise to use HTTP compression since it reduces the network traffic by factor 10-15.
For testing you can request the compressed response with wget:
wget --header="Accept-Encoding: gzip" --user=<USERNAME> --password=<PASSWORD> http://query.published.live1.fas.eu1.fredhopperservices.com/fredhopper-ws/services/FASWebService?method=getAll&input=fh_location%3D//catalog01/en_US
You can activate HTTP compression by adding to the request header "Accept-Encoding: gzip". This can be done in Java (Jax-WS 2.1.1 or later) e.g. like this:
// Establish connection to Fredhopper WebService URL wsdlURL = new URL(FREDHOPPER_ENDPOINT); FASWebServiceService fasServiceService = new FASWebServiceService( wsdlURL, new QName("http://ns.fredhopper.com/XML/output/6.1.0", "FASWebServiceService")); FASWebService fasService = fasServiceService.getFASWebService(); // Request compressed response (don't compress query just in case that the server doesn't understand it) Map<String, List<String>> httpHeaders = new HashMap<String, List<String>>(); httpHeaders.put("Accept-Encoding", Collections.singletonList("gzip")); Map<String, Object> reqContext = ((BindingProvider)fasService).getRequestContext(); reqContext.put(MessageContext.HTTP_REQUEST_HEADERS, httpHeaders); // execute call to Fredhopper WebService Page page = fasService.getAll(query.toString());
| HTTP compression can impact the page loading times. On the one side, decompressing the Fredhopper response in the front-end requires additional CPU. On the other side, the smaller compressed Fredhopper response is transferred quicker through the internet. |
|
Compression of Requests Compression of requests is not supported by the Fredhopper Query API. |
|
Performance Warning Apache HTTP-Client 4.3.2. has a flaw in handling compressed input streams. A better performance can be observed for REST with version 4.3.1. |
Comments
0 comments
Please sign in to leave a comment.