Closed laduke closed 3 months ago
In the underlying data structure, we are using:
type PeopleProfileUpdateCard struct {
Segments []string `json:"segments,omitempty"`
}
It sounds that the omitempty
would kick in there and elude the Segments key from the generated JSON.
Unfortunately we cannot really move Segments to a reference, without breaking all implementations. I'd therefore advise trying to set a dummy segment in place.
ok sounds good. thanks for replying.
I can also just use the internals and avoid the dummy segment
url := fmt.Sprintf("website/%s/people/profile/%s", r.websiteId, userId)
empty := struct {Segments []string `json:"segments"`}{ Segments: make([]string, 0) }
req, err := r.client.NewRequest("PATCH", url, empty)
_, err = r.client.Do(req, nil)
🙃
Thanks for the tip! That looks much cleaner.
hey there. I'm probably just doing something wrong, but I can't delete the last segment from a PersonProfile. Modifying the segments otherwise is working. I'm doing this, basically:
A go serialization empty array gotcha?
If I do :
the patch request body looks like