Update a rule
curl --request PATCH \
--url https://api.getlurk.com/v1/rules/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"name": "<string>",
"when": {
"event": "<string>"
},
"if": [
{
"audience": "<string>"
}
],
"limit": [
{
"max": 3,
"per": "day"
}
],
"do": [
{
"unit": "<string>",
"add": 1,
"hold_over": 123
}
],
"budget": [
{
"unit": "<string>",
"max": 123
}
],
"modify": [
{
"if": [
{
"audience": "<string>"
}
],
"times": 51,
"unit": "<string>"
}
],
"effects": [
{
"post": {
"community": "<string>",
"channel": "<string>",
"text": "<string>",
"channel_name": "<string>",
"every": "hour",
"max_per_day": 12
}
}
]
}
'const options = {
method: 'PATCH',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
when: {event: '<string>'},
if: [{audience: '<string>'}],
limit: [{max: 3, per: 'day'}],
do: [{unit: '<string>', add: 1, hold_over: 123}],
budget: [{unit: '<string>', max: 123}],
modify: [{if: [{audience: '<string>'}], times: 51, unit: '<string>'}],
effects: [
{
post: {
community: '<string>',
channel: '<string>',
text: '<string>',
channel_name: '<string>',
every: 'hour',
max_per_day: 12
}
}
]
})
};
fetch('https://api.getlurk.com/v1/rules/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.getlurk.com/v1/rules/{id}"
payload = {
"name": "<string>",
"when": { "event": "<string>" },
"if": [{ "audience": "<string>" }],
"limit": [
{
"max": 3,
"per": "day"
}
],
"do": [
{
"unit": "<string>",
"add": 1,
"hold_over": 123
}
],
"budget": [
{
"unit": "<string>",
"max": 123
}
],
"modify": [
{
"if": [{ "audience": "<string>" }],
"times": 51,
"unit": "<string>"
}
],
"effects": [{ "post": {
"community": "<string>",
"channel": "<string>",
"text": "<string>",
"channel_name": "<string>",
"every": "hour",
"max_per_day": 12
} }]
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"id": "rule_01m2z44880ev18z457tkgkpp00",
"key": "order-points",
"name": "Points for orders",
"status": "live",
"version": 2,
"live_version": 1,
"definition": {
"when": {
"event": "order.paid"
},
"if": [
{
"property": {
"name": "currency",
"equals": "USD"
}
}
],
"limit": [
{
"max": 3,
"per": "day",
"by": "user"
}
],
"do": [
{
"unit": "points",
"add": {
"from": "total_cents",
"per": 100
}
}
]
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}Rules
Update a rule
Saves a new version of the newest, with the parts you send replaced. A live rule keeps its version until a person takes the new one live. name alone renames, no new version. Saving effects (not available yet) gets a key approval_required, as does renaming a rule with them. Rules.
PATCH
/
v1
/
rules
/
{id}
Update a rule
curl --request PATCH \
--url https://api.getlurk.com/v1/rules/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"name": "<string>",
"when": {
"event": "<string>"
},
"if": [
{
"audience": "<string>"
}
],
"limit": [
{
"max": 3,
"per": "day"
}
],
"do": [
{
"unit": "<string>",
"add": 1,
"hold_over": 123
}
],
"budget": [
{
"unit": "<string>",
"max": 123
}
],
"modify": [
{
"if": [
{
"audience": "<string>"
}
],
"times": 51,
"unit": "<string>"
}
],
"effects": [
{
"post": {
"community": "<string>",
"channel": "<string>",
"text": "<string>",
"channel_name": "<string>",
"every": "hour",
"max_per_day": 12
}
}
]
}
'const options = {
method: 'PATCH',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
when: {event: '<string>'},
if: [{audience: '<string>'}],
limit: [{max: 3, per: 'day'}],
do: [{unit: '<string>', add: 1, hold_over: 123}],
budget: [{unit: '<string>', max: 123}],
modify: [{if: [{audience: '<string>'}], times: 51, unit: '<string>'}],
effects: [
{
post: {
community: '<string>',
channel: '<string>',
text: '<string>',
channel_name: '<string>',
every: 'hour',
max_per_day: 12
}
}
]
})
};
fetch('https://api.getlurk.com/v1/rules/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.getlurk.com/v1/rules/{id}"
payload = {
"name": "<string>",
"when": { "event": "<string>" },
"if": [{ "audience": "<string>" }],
"limit": [
{
"max": 3,
"per": "day"
}
],
"do": [
{
"unit": "<string>",
"add": 1,
"hold_over": 123
}
],
"budget": [
{
"unit": "<string>",
"max": 123
}
],
"modify": [
{
"if": [{ "audience": "<string>" }],
"times": 51,
"unit": "<string>"
}
],
"effects": [{ "post": {
"community": "<string>",
"channel": "<string>",
"text": "<string>",
"channel_name": "<string>",
"every": "hour",
"max_per_day": 12
} }]
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"id": "rule_01m2z44880ev18z457tkgkpp00",
"key": "order-points",
"name": "Points for orders",
"status": "live",
"version": 2,
"live_version": 1,
"definition": {
"when": {
"event": "order.paid"
},
"if": [
{
"property": {
"name": "currency",
"equals": "USD"
}
}
],
"limit": [
{
"max": 3,
"per": "day",
"by": "user"
}
],
"do": [
{
"unit": "points",
"add": {
"from": "total_cents",
"per": 100
}
}
]
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}{
"error": {
"status": 123,
"code": "invalid_json",
"message": "<string>",
"request_id": "<string>",
"doc_url": "<string>",
"param": "<string>",
"next_step": "<string>"
}
}Authorizations
Headers
Body
application/json
Response
Update a rule