Update an article (status needs article.publish; restricted visibility needs a paid plan)
:::openapi-operation PATCH /api/v1/workspaces/{workspace}/articles/{slug} AUTH bearerAuth :::
:::codesamples open Code examples
curl -X PATCH "https://contextowl.co/api/v1/workspaces/string/articles/string" \
-H "Accept: application/json" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
--data '{
"markdown": "string",
"section": "string",
"status": "string",
"title": "string",
"visibility": "string"
}'
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
.uri(URI.create("https://contextowl.co/api/v1/workspaces/string/articles/string"))
.header("Accept", "application/json")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"markdown\": \"string\",\n \"section\": \"string\",\n \"status\": \"string\",\n \"title\": \"string\",\n \"visibility\": \"string\"\n}"))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
import urllib.request
url = "https://contextowl.co/api/v1/workspaces/string/articles/string"
headers = {
"Accept": "application/json",
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
}
data = "{\n \"markdown\": \"string\",\n \"section\": \"string\",\n \"status\": \"string\",\n \"title\": \"string\",\n \"visibility\": \"string\"\n}".encode("utf-8")
req = urllib.request.Request(url, data=data, headers=headers, method="PATCH")
with urllib.request.urlopen(req) as res:
print(res.status)
print(res.read().decode())
const response = await fetch("https://contextowl.co/api/v1/workspaces/string/articles/string", {
method: "PATCH",
headers: {
"Accept": "application/json",
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
},
body: JSON.stringify({
"markdown": "string",
"section": "string",
"status": "string",
"title": "string",
"visibility": "string"
})
});
console.log(response.status);
console.log(await response.json());
package main
import (
"fmt"
"io"
"net/http"
"strings"
"time"
)
func main() {
body := strings.NewReader(`{
"markdown": "string",
"section": "string",
"status": "string",
"title": "string",
"visibility": "string"
}`)
req, err := http.NewRequest("PATCH", "https://contextowl.co/api/v1/workspaces/string/articles/string", body)
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 30 * time.Second}
res, err := client.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
bodyBytes, err := io.ReadAll(io.LimitReader(res.Body, 10<<20))
if err != nil {
panic(err)
}
fmt.Println(res.StatusCode)
fmt.Println(string(bodyBytes))
}
// cargo add reqwest --features blocking
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::blocking::Client::new();
let response = client.request(reqwest::Method::PATCH, "https://contextowl.co/api/v1/workspaces/string/articles/string")
.header("Accept", "application/json")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"markdown\": \"string\",\n \"section\": \"string\",\n \"status\": \"string\",\n \"title\": \"string\",\n \"visibility\": \"string\"\n}")
.send()?;
println!("{}", response.status());
println!("{}", response.text()?);
Ok(())
}
:::
:::details open Parameters (2)
| NAME | IN | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|---|
workspace |
path | string | yes | Workspace id, or - for the key's bound workspace |
slug |
path | string | yes | - |
:::
:::details open Request body (required)
application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
markdown |
string | no | - |
section |
string | no | - |
status |
string | no | - |
title |
string | no | - |
visibility |
string | no | - |
{
"markdown": "string",
"section": "string",
"status": "string",
"title": "string",
"visibility": "string"
}
:::
:::details open Success responses (200)
200
Success
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
slug |
string | yes | - |
{
"slug": "string"
}
:::
:::details Error responses (400, 401, 403, 404, 429)
400
Bad request
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
401
Unauthorized
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
403
Forbidden
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
404
Not found
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
429
Rate limited
Content-Type: application/json
| FIELD | TYPE | REQUIRED | DESCRIPTION |
|---|---|---|---|
error |
object | yes | - |
{
"error": {
"code": "string",
"details": null,
"message": "string",
"status": 0
}
}
:::