Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ $webflow->createItem($collectionId, $fields);
$webflow->updateItem($collectionId, $itemId, $fields);
```

### Patch Collection Item
```
$webflow->patchItem($collectionId, $itemId, $fields);
```

### Remove Collection Item
```
$webflow->removeItem($collectionId, $itemId);
Expand Down
12 changes: 12 additions & 0 deletions src/Webflow/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ private function put($path, $data)
return $this->request($path, "PUT", $data);
}

private function patch($path, $data)
{
return $this->request($path, "PATCH", $data);
}

private function delete($path)
{
return $this->request($path, "DELETE");
Expand Down Expand Up @@ -179,6 +184,13 @@ public function updateItem(string $collectionId, string $itemId, array $fields,
]);
}

public function patchItem(string $collectionId, string $itemId, array $fields, bool $live = false)
{
return $this->patch("/collections/{$collectionId}/items/{$itemId}" . ($live ? "?live=true" : ""), [
'fields' => $fields,
]);
}

public function removeItem(string $collectionId, $itemId)
{
return $this->delete("/collections/{$collectionId}/items/{$itemId}");
Expand Down