Compare commits

...

2 Commits

Author SHA1 Message Date
Louis Baudoux
02c54d3ec1 [FIX] extract_api: remove bill_reference from expense fields
The bill reference is no longer detected since a few months because it
had poor results and wasn't very useful.
2023-10-03 18:44:21 +02:00
Louis Baudoux
2c8d914410 [REM] extract_api: remove documentation of get_result_batch
For security reasons, we had to drop the support of those routes.
2023-10-03 18:37:42 +02:00
2 changed files with 19 additions and 59 deletions

View File

@@ -22,7 +22,7 @@ Overview
========
The extract API uses the JSON-RPC2_ protocol; its endpoint routes are located at
`https://iap-extract.odoo.com`.
`https://extract.api.odoo.com`.
Version
-------
@@ -235,12 +235,8 @@ Routes
------
- /api/extract/invoice/1/get_result
- /api/extract/invoice/1/get_result_batch
- /api/extract/expense/1/get_result
- /api/extract/expense/1/get_result_batch
- /api/extract/applicant/1/get_result
- /api/extract/applicant/1/get_result_batch
- |ss| /api/extract/invoice/1/get_results |se| (deprecated)
- |ss| /iap/invoice_extract/get_result |se| (deprecated)
- |ss| /iap/expense_extract/get_result |se| (deprecated)
@@ -262,10 +258,10 @@ Request
``version`` (required)
|SAME_AS_PARSE|
``documents_uuids`` (required, replaces ``documents_ids``)
The list of ``document_id`` for which you want to get the current parsing status.
``documents_ids`` (deprecated)
The list of ``document_id`` for which you want to get the current parsing status.
``documents_uuid`` (required, replaces ``documents_id``)
The ``document_uuid`` for which you want to get the current parsing status.
``documents_id`` (deprecated)
The ``document_id`` for which you want to get the current parsing status.
.. code-block:: js
@@ -274,18 +270,12 @@ Request
"method": "call",
"params": {
"version": int,
// "documents_ids": [], // deprecated
"documents_uuids": [],
// "documents_id": int, // deprecated
"documents_uuid": int,
},
"id": string,
}
.. note::
The code snippet shows the request to the ``/api/extract/invoice/1/get_result_batch`` route.
You can use the endpoint ``/api/extract/invoice/1/get_result`` to get the result of a single
document. In that case, you don't need to provide a list of ``document_uuids`` but a single
``document_uuid``.
Response
--------
@@ -324,48 +314,21 @@ are the name of the field and the value is the value of the field.
"jsonrpc": "2.0",
"id": string,
"result": {
"document_id_1": {
"status": string,
"status_code": int, // deprecated
"status_msg": string,
"results": [
{
"full_text_annotation": string,
"feature_1_name": feature_1_result,
"feature_2_name": feature_2_result,
...
},
"status": string,
"status_code": int, // deprecated
"status_msg": string,
"results": [
{
"full_text_annotation": string,
"feature_1_name": feature_1_result,
"feature_2_name": feature_2_result,
...
]
},
"document_id_2": {
"status": string,
"status_code": int, // deprecated
"status_msg": string,
"results": [
{
"full_text_annotation": string,
"feature_1_name": feature_1_result,
"feature_2_name": feature_2_result,
...
},
...
]
},
...
},
...
]
}
}
.. note::
The example shows the response from the ``/api/extract/invoice/1/get_result_batch`` route.
When using the ``/api/extract/invoice/1/get_result`` route (note the singularity), the response
will be the value of the key associated to the invoice.
.. warning::
Result keys are strings despite the fact that the ``document_ids`` given in the request body are
integers.
Common fields
~~~~~~~~~~~~~
@@ -553,9 +516,6 @@ fields we can extract from an expense report.
+-------------------------+------------------------------------------------------------------------+
| ``currency`` | ``content`` is a string |
+-------------------------+------------------------------------------------------------------------+
| ``bill_reference`` | ``content`` is a string |
+-------------------------+------------------------------------------------------------------------+
Applicant
~~~~~~~~~

View File

@@ -6,7 +6,7 @@ import time
import requests
account_token = "integration_token" # Use your token
domain_name = "https://iap-extract.odoo.com"
domain_name = "https://extract.api.odoo.com/"
path_to_pdf = "/path/to/your/pdf"
doc_type = "invoice" # invoice, expense or applicant