processing_state API returns "processing" even when the document is ready in Concept insight - ibm-cloud

Steps I followed:
First create corpus, then send create a document in it.
Check if the processing of the document is ready (done processing)
https://gateway.watsonplatform.net/concept-insights/api/v2/corpora/{account-id}/{corpus-name}/documents/{document-name}/processing_state
If it is ready then i retrieve the related_concepts in the document
https://gateway.watsonplatform.net/concept-insights/api/v2/corpora/{account-id}/{corpus-name}/documents/{document-name}/related_concepts
All the above steps are working (I get a 200/201 reply from Bluemix server).
The problem is in the reply of step 2. I keep getting the following response
{ "status": "processing", "last_modified": "2015-11-10T15:27:12.473Z" }
But when I do step 3, I am getting the desired response (the related concepts in the document)
{
"concepts" : [
{
"score" : ...,
"concept" : {
"id": "........",
"label": ".....
}
}, .....
]
}
UPDATE
The processing_state API problem has been fixed. Gives the desired response

The processing_state API problem has been fixed. Gives the desired response now.

Related

Cloud Firestore: Add/remove items in ArrayValue field via REST API's PATCH method?

I'm looking for a way to add/remove data from an ArrayValue field, via the Firestore REST API.
I'm able to send the following PATCH request, to set all values of an array fields in a document, via the following:
Request Url
/v1beta1/projects/MY_APP/databases/(default)/documents/MY_COLLECTION/MY_DOCUMENT_ID?updateMask.fieldPaths=document_array&key=MY_KEY
Request Body
{
"fields" : {
"document_array" : {
"arrayValue" : {
"values" : [
{ "stringValue" : "item_value_0" },
{ "stringValue" : "item_value_1" }
]
}
}
}
}
As expected, the document with id MY_DOCUMENT_ID in collection MY_COLLECTION updates so that the document_array field is populated with strings:
['item_value_0', 'item_value_1'].
Using the REST APIs PATCH method, I would like to add/remove/update/manipulate ArrayValue fields in my document MY_DOCUMENT_ID (ie as outlined in this question).
Is this possible? If so, how?
Thanks in advance
It's not possible today. You could file a feature request stating what you want (it's been asked before).

Any default APIs in Dolibarr for creating sales order records?

Dolibarr has a module for restful APIs.
The API explorer seems to show all the CRUD tasks for each module like orders, stock and customer.
But to CREATE a record, the sample VALUE for the POST method shows as:
{
"request_data": [
"string"
]
}
What are the specific field attributes that should go in here?
Where can I look up the field requirements?
You should take a look at the attributes of the Commande class:
https://github.com/Dolibarr/dolibarr/blob/develop/htdocs/commande/class/commande.class.php
The object should be something like this :
{
"date_commande" : "0000-00-00 00:00:00",
"date_livraison" : "0000-00-00 00:00:00",
"attribute3": "and so on"
}
When you need a parameter like
{ "request_data": [ "string" ] } for a POST API, all you have to do is to call the similar API to get a record (so the same API with the GET method). The result can be cut and paste to be used to create a new record (just change the id and ref in the answer retreived by the GET).

Find DocumentId through Discovery GUI tool

I want to train my Discovery collection where I have already uploaded over 200 documents. I uploaded these documents through the GUI. Looking through the Discovery documentation, I know that I have will have to make API calls to train my collection since the training API has not been exposed through the GUI yet. As part of the training API calls I need to include a document that looks like this:
{
"natural_language_query": "{natural_language_query}",
"filter": "{filter_definition}"
"examples": [
{
"document_id": "{document_id_1}",
"cross_reference": "{cross_reference_1}",
"relevance": 0
},
{
"document_id": "{document_id_2}",
"cross_reference": "{cross_reference_2}",
"relevance": 0
}
]
}
My question is how should I get the documentIds for the documents that I have already uploaded? Is there a way to find this through the GUI? Or perhaps an API call that will return something like:
{
"document_name" = "MyDocument1",
"documentId" = "the_document_id_for_MyDocument1"
},
...
{
"document_name" = "MyDocumentN",
"documentId" = "the_document_id_for_MyDocumentN"
}
Or would the only way to get the documentIds would be to create a new collection and upload all of the documents through API calls directly and track the documentIds as I get them back?
Using the GUI, perform the following steps:
Input term(_id) in the "Group query results (Aggregation)"
textbox.
Under "Fields to return", select "Specify" to input
extracted_metadata
Note, that query and filter inputs should remain empty

How can I call beforeSave methods recursively while saving associative data in CakePHP 3?

I am trying to write a REST Api using CakePHP 3.
I have two tables Documents and DocumentImages, when I send POST request with body:
{
"description": "Short Desc.",
"company_id": 2,
"department_id": 3,
"status": 0,
"document_images":[
{
"base64" : "xyz"
},
{
"base64" : "abc"
}
]
}
It saves both to Documents and DocumentImages and makes the document_id of images as it must be.
Now, I need to do something after saving the document and before saving the images, however beforeSave function in images never be called, so it saves both of the entities in DocumentsController.
What can I do for catch the event after the document saved but before the images save?
By the way, if anyone suggest a solution using CRUD I will be very appreciate.

RESTful API: Pagination issue

I've been working on a RESTful service in the last few months and I'm having issues with pagination on the client side.
On server side, many GET requests are paginated (cursor-based).
Every resource has two common fields: "updated" and "created".
E.g. let's say I want to retrieve a list of resources
GET /resources =>
{
"resources" : [
{
"id": 10,
"updated" : "iso8601_date_goes_here"
},
{
"id": 9,
"updated" : "iso8601_date_goes_here"
},
{
"id": 8,
"updated" : "iso8601_date_goes_here"
}
],
"pagination" : {
"before": 11,
"after": 7
}
}
Resources are sorted by "updated" field.
Navigating through "windows" (I called them like that, as they're not pages) is rather easy.
Also, retrieving new resources is trivial thanks to the "created"/"updated" fields.
The question is:
How can I notify the client that a resource has been deleted?
Our iOS app relies on Core Data.
After the JSON response is parsed, we create Core Data objects and then we display those via NSFetchResultController/UICollectionView combination.
P.S. What we're trying to avoid is to invalidate the whole set of data.
Thanks for your help, and have a fantastic rest of the year.