Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Update a Segment via API call #7987

Copy link
Copy link
Open
@theomeuh

Description

@theomeuh
Issue body actions

Discussed in https://github.com/orgs/Unleash/discussions/7980

Originally posted by theomeuh August 26, 2024
I'm trying to migrate some data we have in Unleash and I need to automatically update Segment via API. I'm referring to this endpoint: https://docs.getunleash.io/reference/api/unleash/update-segment

Context

It says: "Any fields not specified will be left untouched", but if I try to PUT an empty body, I got a 400 Bad Request {"id":"1dd37e9f-2b75-458b-b7ca-1424e0561479","name":"BadDataError","message":"Request validation failed: your request body or params contain invalid data. Refer to the details list for more information.","details":[{"message":"\"name\" is required."}]}

Then let's add a "dummy name".. I got the same message but this time, it is the field "constraints" which is apparently missing.

My question: is the doc up-to-date ? It really looks like a PUT (like the endpoint verb says) and not a PATCH (like the description says), do you confirm ?

PS: what I really want is to update "constraints" but unfortunately, I have the "name is required" error when I try to just push a payload with only "constraints"

Current behavior

A PUT requests on api/admin/segments/:id with in body a json containing only the key constraints returns a 400, saying the field name is required

Expected behavior

A PUT requests on api/admin/segments/:id with in body a json containing only the key constraints must return a 200 (and update the constraints field)

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

Todo
Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.