# Query Record Revisions

**URL:** <https://forum.kintone.dev/t/query-record-revisions/126>\
**Category:** General\
**Created:** [July 19, 2019, 5:36pm UTC](https://forum.kintone.dev/t/query-record-revisions/126 "2019-07-19T17:36:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [July 19, 2019, 5:36pm UTC](https://forum.kintone.dev/t/query-record-revisions/126/1 "2019-07-19T17:36:28Z")

</div>

Hi, I need to get the previous data of a record before it was updated. I was trying to&nbsp;[query](https://forum.kintone.dev/hc/en-us/articles/360019245194) 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}

&nbsp;

result:

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

&nbsp;

query 2:&nbsp;

{“app”:22,“query”:"Record\_number = “15” and \_\_REVISION\_\_ = “5"”,“totalCount”:true}

&nbsp;

result:

{“code”:“GAIA\_IQ11”,“id”:“94kEpWqSSmcSVM94islJ”,“message”:“Specified field (\_\_REVISION\_\_) not found.”}

&nbsp;

query 3:

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

&nbsp;

result:&nbsp;

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

Thank you very much.

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [July 19, 2019, 5:43pm UTC](https://forum.kintone.dev/t/query-record-revisions/126/2 "2019-07-19T17:43:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [July 20, 2019, 1:58pm UTC](https://forum.kintone.dev/t/query-record-revisions/126/3 "2019-07-20T13:58:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [July 21, 2019, 1:00am UTC](https://forum.kintone.dev/t/query-record-revisions/126/4 "2019-07-21T01:00:17Z")

</div>

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.
