Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API update does not work with multiple blocks #835

Open
tetsumaki opened this issue Sep 26, 2024 · 5 comments · May be fixed by #910
Open

API update does not work with multiple blocks #835

tetsumaki opened this issue Sep 26, 2024 · 5 comments · May be fixed by #910

Comments

@tetsumaki
Copy link

tetsumaki commented Sep 26, 2024

Hi,

Everything worked fine when I had a single block (id 1) with several fields (76666 -> 76671).

I then created a new block (id 2) with fields 76672 -> 76673.

When I want to update my fields in the 1st block, API says True (OK), but it doesn't actually do anything, whereas it did before.

But on a new block, it works.

If I make block (id 2) inactive, block 1 works again.

The problem occurs as soon as there is more than one block.

GLPI: 10.0.16
Fields: 1.21.13

@tetsumaki
Copy link
Author

Hello, this bug is fixed by 1.21.17 ?

https://github.com/pluginsGLPI/fields/blob/1.21.17/CHANGELOG.md

Fix fields updates with multiple containers via the API.

Thanks.

@stonebuzz
Copy link
Contributor

Yes =)

@stonebuzz
Copy link
Contributor

Hi @tetsumaki

Following publication of the patch designed to resolve your problem with updating several containers in a single call, we have noticed some undesirable side-effects on the Fields plugin.

After analysis, we have decided to reverse this change in the new version of the plugin (1.21.18), which is due to go live today.

To get around your current problem, we recommend that you make as many calls to the API as there are containers on your object. For each call, be sure to specify the c_id key (identifier of the container concerned) in the payload. This will enable the plugin to correctly reconcile the Fields plugin data with the corresponding container.

Best regards

@tetsumaki
Copy link
Author

tetsumaki commented Jan 21, 2025

Hi @stonebuzz
Is it possible to describe the PUT API query please?
I couldn't find anything in the documentation.
How do I retrieve the c_id?
Today I'm doing this to modify a field from host id 4145 in my example:

{
  "id": "4145",
  "pmpatchingslotfield": "2"
}

Should I do it like this, for example?

{
  "id": "4145",
  "c_id": "1",
  "pmpatchingslotfield": "2"
}

And if I understand correctly, it's no longer possible to update several fields in a single request if they're in different c_id.

@stonebuzz stonebuzz linked a pull request Jan 21, 2025 that will close this issue
4 tasks
@stonebuzz
Copy link
Contributor

hi @tetsumaki

can you apply this -> #910

and retry with this paylaod

{
  "id": "4145",
  "c_id": "1",
  "pmpatchingslotfield": "2"
}

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants