Query Record Revisions

Hi, I need to get the previous data of a record before it was updated. I was trying to query it by using the field $revision and Record_number but its not working.

These are the queries that I have tried so far:

query 1:
{“app”:22,“query”:"Record_number = “15” and $revision = “5"”,“totalCount”:true}

 

result:

{“code”:“CB_VA01”,“id”:“eMgPESBws2h27rLm24mA”,“message”:“Missing or invalid input.”,“errors”:{“query”:{“messages”:[“unsupported query format”]}}}

 

query 2: 

{“app”:22,“query”:"Record_number = “15” and __REVISION__ = “5"”,“totalCount”:true}

 

result:

{“code”:“GAIA_IQ11”,“id”:“94kEpWqSSmcSVM94islJ”,“message”:“Specified field (__REVISION__) not found.”}

 

query 3:

{“app”:22,“query”:"Record_number = “15” and revision = “5"”,“totalCount”:true}

 

result: 

{“code”:“GAIA_IQ11”,“id”:“Qhn70NmYAXIPa2meoUGQ”,“message”:“Specified field (revision) not found.”}

Thank you very much.

Hello, I am working with Wendy on this and I’d like to add that I’ve tried multiple variations using kintone.api(kintone.api.url(’/k/v1/record’, true), ‘GET’ as well. While I don’t receive errors, it appears the various “revision” keys I’ve tried are being ignored.

The reason we need this is to determine field changes after receiving Kintone webhooks on record edits. I’d be happy to take a better/easier route, if there is one. Thank you.

I investigated how the “History” tab works in the UI and saw this XHR request:

https://{host}.kintone.com/k/api/app/550/record/18/getChange.json

Is it possible for us to use this endpoint? Any documentation?

There is no API that can retrieve the change history now.
You can’t also specify a revision for query in GET and get past records.

Instead, you can get it in DOM, or keep the information at each event and compare it.

For DOM, you might want to place a button (event)
to process to get the change history by DOM and then add a record while text processing with JS.

However, in your scenario, since it seems to be a little difficult in the operation when you take it in DOM, I think it is better to take the following workaround.

  1. Create an app to save change history.
  2. After each save success, use the event (submit.success) and register (POST) with record information in the app created in 1
    when adding new records or editing records.

By doing this, the changed information remains as a record,
so such as with GET, you will be able to retrieve pre-change record information depending on the changed information or revision.

However, there is one problem in this case.
Because JS is used and the change history is saved in a record,
such as when you change an API record,updates in a way that JS does not fire, cannot be recorded.

>The reason we need this is to determine field changes after receiving Kintone webhooks on record edits
I wonder if the following is something you can do for above.

• Notify edits with kintone webhook
→You want to determine where it was edited where you received the webhook.

If that is the case, then create another app as described above,
I think that it is possible to do if the comparison processing is only made in the receiver.

>https://{host}.kintone.com/k/api/app/550/record/18/getChange.json
I could not find this API above at this official Kintone developer site and do not think the specification is published since the only APIs available are published on the site.