Change a segment
package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://reputecast.example.com/api/v1/workspaces/acme-newsletter/segments/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
payload := strings.NewReader("{ \"definition\": { \"groups\": [ { \"conditions\": [ { \"amount\": 1, \"field\": \"example\", \"op\": \"example\", \"to\": \"example\", \"unit\": \"days\", \"value\": \"example\" } ], \"match\": \"all\" } ] }, \"description\": \"example\", \"mode\": \"builder\", \"name\": \"example\", \"refresh\": \"dynamic\", \"sql\": \"example\" }")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}const url = 'https://reputecast.example.com/api/v1/workspaces/acme-newsletter/segments/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"definition":{"groups":[{"conditions":[{"amount":1,"field":"example","op":"example","to":"example","unit":"days","value":"example"}],"match":"all"}]},"description":"example","mode":"builder","name":"example","refresh":"dynamic","sql":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://reputecast.example.com/api/v1/workspaces/acme-newsletter/segments/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "definition": { "groups": [ { "conditions": [ { "amount": 1, "field": "example", "op": "example", "to": "example", "unit": "days", "value": "example" } ], "match": "all" } ] }, "description": "example", "mode": "builder", "name": "example", "refresh": "dynamic", "sql": "example" }'Permission: segments:edit
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Workspace slug
Workspace slug
Segment id
Segment id
Request Bodyrequired
Section titled “Request Bodyrequired”object
object
object
object
All = every condition, any = at least one
Responses
Section titled “Responses”OK
object
object
object
object
All = every condition, any = at least one
object
Example
{ "definition": { "groups": [ { "conditions": [ { "unit": "days" } ], "match": "all" } ] }, "mode": "builder", "refresh": "dynamic"}default
Section titled “default”Error
object
Stable error code, e.g. permission_denied
A human-readable explanation specific to this occurrence of the problem.
Optional list of individual error details
object
Where the error occurred, e.g. ‘body.items[3].tags’ or ‘path.thing-id’
Error message text
The value at the given location
Members who hold the missing permission
A URI reference that identifies the specific occurrence of the problem.
object
The missing permission key
HTTP status code
A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
A URI reference to human-readable documentation for the error.
Example
{ "detail": "Property foo is required but is missing.", "instance": "https://example.com/error-log/abc123", "status": 400, "title": "Bad Request", "type": "about:blank"}