Skip to content

Question about array field PUT rest api #752

Answered by DanRibbens
gonzamoiguer asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @gonzam88,

As you've figured already, sending the PUT with items missing from the array will update the "content" to be missing your other data and there isn't a way to tell Payload to leave them in. The array IDs was added to allow undefined fields to be saved correctly array objects shift around. There isn't a PATCH operation that would give you this today.

You would need to make a custom endpoint for that. Alternatively you could structure your data to be an array that contains relationships. In that way the collection would have an endpoint that can modify one single item from having it's own collection, but that would have other implications to editor experience.

Is there somethi…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gonzamoiguer
Comment options

Answer selected by gonzamoiguer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants