Post

4 followers Follow
1
Avatar

Will an item update done via the API trigger hooks?

I am currently working on a script, which goes on an infinite loop after an update, by probably triggering the update hook on each update.

My understanding was that an update via API wouldn't trigger the hook.

If this is true, is there a way to prevent this behavior?

Shahil Sham

Please sign in to leave a comment.

15 comments

0
Avatar

Hi Shahil

I will add a parameter to the item API methods so you can disable hook calls for your change. I will let you know when it is ready.

Christian

Christian Holm 0 votes
0
Avatar

In the mean time you can look for the created_via on the lastest revision to see who made the update and halt if it was your own integration.

/Andreas

Andreas Haugstrup Pedersen 0 votes
0
Avatar

Hi again

The item create, update and delete methods now have a "hook" parameter, you can set to false to avoid hook calls.

Christian

Christian Holm 0 votes
0
Avatar

Has this "hook" parameter been added in the Java wrapper?

Thanks in advance!

Sarah Zumwalde 0 votes
0
Avatar

It's a little unclear, yeah. Hook and Silent parameters always to into the options array in podio-php

/Andreas

Andreas Haugstrup Pedersen 0 votes
0
Avatar

I can see the Silent parameter in the Java API client for item create, update, and delete; however, I do not see the Hook parameter. Is it possible for hooks to be disabled if the Hook parameter is added in the same way as the Silent parameter in podio-java? Why does podio-java include the Silent param and not the Hook?

Sarah Zumwalde 0 votes
0
Avatar

Hi Sarah,

The hook parameter was introduced much later than silent and was probably just never added to the java client. Should be simple to add yourself. If you're feeling adventurous you can make the change and create a pull request on github so we can get it added to the main repository. :)

/Andreas

Andreas Haugstrup Pedersen 0 votes
3
Avatar

Hi Christian,

It seems like "file.change" API is not considering the hook => false parameter and triggering further hooks. Can you please check this

Ansar Muhammad (Anz) 3 votes
0
Avatar

Hi Christian,

Can you help on this. We are working on an integration which needs the file.change hook work proper with this parameter. The work around suggested by Andreas will not be helpful for us in some cases.

Thanks
Anz

Ansar Muhammad (Anz) 0 votes