Split from Bug #759983 point number 2. It sort of overlaps a bit with Bug #831887 Currently there isn't a proper way to tell what percentage a Translation Document is at via the REST API without trying to manually calculate it using the number of strings in the Source Document and the number of available translated text-flows in the Translation Document. As such it would be handy if there was a mechanism to get this type of information via the REST API.
Would you want to fetch all locale stats for a document at once, or separately?
Stats would be fetched at the document level and at the view, and return stats for all locales at once.
In terms of the API design, I think it should look something like this: <stats-list [group="GROUP7"] project="foo_installation_guide" version="3.1" [docId="Author_Info"]> <translation-stats code="ja-JP" totalStrings="3000" translatedStrings="2900" need-review-strings="99" total-words="33217" translated-words="32846" need-review-words="1000" /> ... <stats-list> (where group and docId are intended for other REST API points, at the project group level, or the document level), with URL parameters to choose whether the word stats are included, and to request a single locale's stats.
Added a statistics REST API endpoint. Currently supports fetching stats at the iteration and document level in both XML and JSON formats. Sample URL for iteration stats (GET): http://<server>/rest/stats/<project-slug>/iter/<iteration-slug> And for document stats (GET): http://<server>/rest/stats/<project-slug>/iter/<iteration-slug>/doc/<docId> (Doc id may contain slashes) Please see the REST API documentation for the message format returned by these calls. Additional query parameters for these endpoints: word - Indicates whether to return Word level statistics detail - (Only supported for the iteration level stats). Fetches detailed stats for documents contained in the iteration in the same call. locale - Indicates the locale Ids to fetch stats for. May be provided multiple times to fetch stats for multiple locales. If not provided, stats for all available iteration locales will be returned.
Please see: https://github.com/zanata/zanata/commit/d3f3f9059cca656b6aa67f33f2dcadab7cc2f762 https://github.com/zanata/zanata/commit/76439d190b03237b87bba2a81a377d0556385643 https://github.com/zanata/zanata/commit/4f837ba5f2940feb4970cc28f400859a43eb97c3 https://github.com/zanata/zanata/commit/fe72657be6c9a20253138f4aea00e85b027d0264 https://github.com/zanata/zanata/commit/36476e0594d965c617120c86359e8af12282f04c And also: https://github.com/zanata/zanata/commit/249c27dae7c063c31035466dd9257edfe6931e54 https://github.com/zanata/zanata/commit/9fcce0245a42c01033389fde6536184847a58a7a https://github.com/zanata/zanata/commit/3c29d35b1bf44524a0637df344bda6de0a8fa479 https://github.com/zanata/zanata/commit/92f42eee4cc7d59c285f5841e0f588ef1815e325
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Cause Zanata does not offer a way to query translation statistics via REST. Consequence External clients in need of translation stats from Zanata had to resort to screen scraping and other methods to get the information. Change Added Statistics REST endpoint to fetch translation statistic data from Zanata. Currently supports version and document level statistics. (Please see the REST API documentation for details on this service.) Result External clients are now able to fetch translation statistics via the REST API, without resorting to screen scraping.
Correction on the endpoints above. They should be: Sample URL for iteration stats (GET): http://<server>/rest/stats/proj/<project-slug>/iter/<iteration-slug> And for document stats (GET): http://<server>/rest/stats/proj/<project-slug>/iter/<iteration-slug>/doc/<docId>
VERIFIED with 1.8.0-SNAPSHOT (20120810-0025)
Reassigning to add client enhancements.
Added java and maven client statistics commands. For details on usage type mvn zanata:help -Dgoal=stats -Ddetail Zanata maven client 1.8.0-SNAPSHOT See: https://github.com/zanata/zanata/commit/b3628c711f5e8239387902291aaf04f915d1ab24 https://github.com/zanata/zanata/commit/201587b0c50d78b54de3b7e13e40c9af5a40dea8 https://github.com/zanata/zanata/commit/89527b89a61e425723487185ae5cc3943c322fdb
VERIFIED with Zanata version 1.8.0-SNAPSHOT (20120816-1023) Please note that the RFE of client support is filed as Bug 848988
Oops, it seems that it returns empty statistic for the document that has no translation but haven't been edited. Reassigned.
Zanata now returns stats for all requested languages, even if they have not been translated. See: https://github.com/zanata/zanata/commit/91cfe0346544794743ea9c7f610fba31f7b67430
VERIFIED with Zanata version 1.8.0-SNAPSHOT (20120821-1123)
Fix released in Zanata 2.0.