nz365guy

View Original

Netbreeze Full Document Feed

The Netbreeze API provides a convenient way to retrieve a list of all documents found by your solution. You can use this for example to import documents into your CRM. After reading this guide, you should be able to:

  • Find all documents found by a solution.

  • Find only the newest documents since your last retrieval.

This guide is based on API version 1 (v1).

1. Retrieving the First Documents

To retrieve the first documents, simply make an authenticated HTTPS GET request on the resource fullfeed:

Request:

GET https://data.netbreeze.ch/api/version/v1/solutions/{solutionId}/fullfeed HTTP 1.0Accept: application/JSONAuthorization: Basic {your authentication token}

The request above retrieves a list of the first 100 documents (content and meta data) from the given solution, ordered by ascending document ID.

The API responds with a batch of documents. Batches have a maximum size of 100 documents, but you can set your own smaller batch size by appending the parameter size with an integer (smaller than 100) to your request URL.

JSON-Response (with HTTP Status Code 200) for the solution 3293:

{"Documents": {"Document": [{"aquisitionDate": "2012-01-01-05:22:22","channel": "Blogs","contentText": "Press Release: HERNDON, Va., September 1, 2011 ? Audi has left nothing untouched in the newly redesigned Audi A6, from the exterior?s classic, yet contemporary appearance to a variety of powertrain options that include the award-winning 2.0 TFSI® and 3.0 TFSI engines. Impressive performance and efficiency contribute to the overall appeal of the all-new 2012 A6, as does the exterior. The extended wheelbase shortens overhangs to give the Audi A6 a more performance-oriented look while delivering improved ride quality and ...Source: http://www.distrocars.com/2012-audi-a6-3-0-tfsi-quattroRussell William Wallace Jr Blake Griffin DuPont National Guard Military Intelligence Johnny Andrew Sauter Detroit Pistons Bobby Labonte","id": "40000359","language": "en","publicationDate": "2011-12-31-23:43:09","publisher": "jesamputian - jesamputian.typepad.com","title": "2012 Audi A6 3.0 TFSI Quattro Lightweight Construction & MMI System with Supercharged V6 Engine 310 hp Torque 325 lb-ft 8 Speed Tiptronic Transmission","URI": "http://jesamputian.typepad.com/blog/2011/12/2012-audi-a6-30-tfsi-quattro-lightweight-construction-mmi-system-with-supercharged-v6-engine-310-hp-torque-325-lb-ft-8-spe.html","visibility": "0"},{"aquisitionDate": "2012-01-01-05:22:25","channel": "Blogs","contentText": "AUDI WHEEL CENTER HUB CAP A4 A6 QUATTRO RS6 TT ALLROAD 18 " WHEELS by Audi Buy new: $35.95 (Visit the Hot New Releases in Wheels & Tires list for authoritative information on this product ' s current rank.)Find the best price Click Here","id": "40000362","language": "en","publicationDate": "2011-12-31-21:04:00","publisher": "raya - wheelss45.blogspot.com","title": "AUDI WHEEL CENTER HUB CAP A4 A6 QUATTRO RS6 TT ALLROAD 18" WHEELS","URI": "http://wheelss45.blogspot.com/2011/12/audi-wheel-center-hub-cap-a4-a6-quattro.html","visibility": "1"},... // Up to 98 more documents]},"nextRequestURL": "https://data.netbreeze.ch/api/version/v1/solutions/3293/fullfeed?fromId=40000479","size": "100","totalHits": "45535"}

As you can see, the response not only lists the documents with full content and meta data, but also some additional attributes:

nextRequestURL A link to request the next documents (only appears if more documents exist). size The number of documents in the response. totalHits The total number of documents with an id larger than fromId.

The Netbreeze API supports responses in JSON and XML. So, to request an XML response simply use ‘Accept: application/XML' in your request.

2. Retrieving All Documents

To retrieve all documents of a solution, you simply start by retrieving the first documents (as shown above) and then make another request with the returned nextRequestURL and repeat this until the attribute nextRequestURL does not exist. So the next request after the first should look like this:

Request:

GET {nextRequestURL} HTTP 1.0Accept: application/JSONAuthorization: Basic {your authentication token}

If a request fails (your timeout should be 30 seconds), please wait for 5 minutes until you start your next request.

3. Retrieving Only New Documents

To fetch the newest documents of a solution since your last retrieval, you need to locally store the id of the newest document you retrieved and use this for the URL request parameter fromId.

So if your newest locally stored document is:

{abstractText : "...",visibility : ...,channel : "...",language : "...",publicationDate : "...",publisher : "...",id : 321,...}

your request for the next new documents of solution 123 should look like this:

GET https://data.netbreeze.ch/api/version/v1/solutions/123/fullfeed/?fromId=321 HTTP 1.0Accept: application/JSONAuthorization: Basic {your authentication token}

If the response contains a nextRequestURL, repeat the requests with the nextRequestURL until the attribute nextRequestURL does not exist.

We typically advise to check for new documents every 30 minutes.