🔹 operation: create
Cria um novo pen com um slug gerado automaticamente.
JSON
cURL
PHP
Node.js
Python
Go
{
"action" : "manage_pens"
"token" : "[SEU_TOKEN]" ,
"operation" : "create" ,
"title" : "My Pen" ,
"html" : "<div>Hello</div>" ,
"css" : "body { color: blue; }" ,
"js" : "console.log('hi');" ,
"template" : null
}
curl -X POST "https://serverless.crom.me/api/v1" \
-H "Content-Type: application/json" \
-d '{
"action": "manage_pens",
"token": "[SEU_TOKEN]",
"operation": "create",
"title": "My Pen",
"html": "<div>Hello</div>",
"css": "body { color: blue; }",
"js": "console.log('\''hi'\'');",
"template": null
}'
<?php
$url = "https://serverless.crom.me/api/v1";
$data = [
"token" => "[SEU_TOKEN]",
"action" => "manage_pens",
"operation" => "create",
"title" => "My Pen",
"html" => "<div>Hello</div>",
"css" => "body { color: blue; }",
"js" => "console.log('hi');",
"template" => null
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
const url = 'https://serverless.crom.me/api/v1';
const data = {
action: 'manage_pens',
token: '[SEU_TOKEN]',
operation: 'create',
title: 'My Pen',
html: '<div>Hello</div>',
css: 'body { color: blue; }',
js: "console.log('hi');",
template: null
};
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
})
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));
import requests
url = "https://serverless.crom.me/api/v1"
payload = {
"action": "manage_pens",
"token": "[SEU_TOKEN]",
"operation": "create",
"title": "My Pen",
"html": "<div>Hello</div>",
"css": "body { color: blue; }",
"js": "console.log('hi');",
"template": None
}
response = requests.post(url, json=payload)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://serverless.crom.me/api/v1"
payload := map[string]interface{}{
"action": "manage_pens",
"token": "[SEU_TOKEN]",
"operation": "create",
"title": "My Pen",
"html": "<div>Hello</div>",
"css": "body { color: blue; }",
"js": "console.log('hi');",
"template": nil,
}
jsonPayload, _ := json.Marshal(payload)
resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonPayload))
defer resp.Body.Close()
fmt.Println("Status da Resposta:", resp.Status)
}
Resposta de sucesso: {"success": true, "id": 123, "slug": "a1b2c3d4", "operation": "create"}
🔹 operation: read
Retorna os detalhes completos de um Pen específico através do slug.
JSON
cURL
PHP
Node.js
Python
Go
{
"action" : "manage_pens"
"token" : "[SEU_TOKEN]" ,
"operation" : "read" ,
"slug" : "a1b2c3d4"
}
curl -X POST "https://serverless.crom.me/api/v1" \
-H "Content-Type: application/json" \
-d '{
"action": "manage_pens",
"token": "[SEU_TOKEN]",
"operation": "read",
"slug": "a1b2c3d4"
}'
<?php
$url = "https://serverless.crom.me/api/v1";
$data = [
"token" => "[SEU_TOKEN]",
"action" => "manage_pens",
"operation" => "read",
"slug" => "a1b2c3d4"
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
const url = 'https://serverless.crom.me/api/v1';
const data = {
action: 'manage_pens',
token: '[SEU_TOKEN]',
operation: 'read',
slug: 'a1b2c3d4'
};
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
})
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));
import requests
url = "https://serverless.crom.me/api/v1"
payload = {
"action": "manage_pens",
"token": "[SEU_TOKEN]",
"operation": "read",
"slug": "a1b2c3d4"
}
response = requests.post(url, json=payload)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://serverless.crom.me/api/v1"
payload := map[string]interface{}{
"action": "manage_pens",
"token": "[SEU_TOKEN]",
"operation": "read",
"slug": "a1b2c3d4",
}
jsonPayload, _ := json.Marshal(payload)
resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonPayload))
defer resp.Body.Close()
fmt.Println("Status da Resposta:", resp.Status)
}
Resposta: {"id": 123, "slug": "a1b2c3d4", "title": "My Pen", "html": "...", "css": "...", "js": "...", "template": null, "created_at": "...", "updated_at": "..."}
🔹 operation: update
Atualiza as informações de um Pen existente identificado pelo slug.
JSON
cURL
PHP
Node.js
Python
Go
{
"action" : "manage_pens"
"token" : "[SEU_TOKEN]" ,
"operation" : "update" ,
"slug" : "a1b2c3d4" ,
"title" : "Updated Title" ,
"html" : "<div>Updated</div>" ,
"css" : "body { color: red; }" ,
"js" : "console.log('updated');"
}
curl -X POST "https://serverless.crom.me/api/v1" \
-H "Content-Type: application/json" \
-d '{
"action": "manage_pens",
"token": "[SEU_TOKEN]",
"operation": "update",
"slug": "a1b2c3d4",
"title": "Updated Title",
"html": "<div>Updated</div>",
"css": "body { color: red; }",
"js": "console.log('\''updated'\'');"
}'
<?php
$url = "https://serverless.crom.me/api/v1";
$data = [
"token" => "[SEU_TOKEN]",
"action" => "manage_pens",
"operation" => "update",
"slug" => "a1b2c3d4",
"title" => "Updated Title",
"html" => "<div>Updated</div>",
"css" => "body { color: red; }",
"js" => "console.log('updated');"
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
const url = 'https://serverless.crom.me/api/v1';
const data = {
action: 'manage_pens',
token: '[SEU_TOKEN]',
operation: 'update',
slug: 'a1b2c3d4',
title: 'Updated Title',
html: '<div>Updated</div>',
css: 'body { color: red; }',
js: "console.log('updated');"
};
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
})
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));
import requests
url = "https://serverless.crom.me/api/v1"
payload = {
"action": "manage_pens",
"token": "[SEU_TOKEN]",
"operation": "update",
"slug": "a1b2c3d4",
"title": "Updated Title",
"html": "<div>Updated</div>",
"css": "body { color: red; }",
"js": "console.log('updated');"
}
response = requests.post(url, json=payload)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://serverless.crom.me/api/v1"
payload := map[string]interface{}{
"action": "manage_pens",
"token": "[SEU_TOKEN]",
"operation": "update",
"slug": "a1b2c3d4",
"title": "Updated Title",
"html": "<div>Updated</div>",
"css": "body { color: red; }",
"js": "console.log('updated');",
}
jsonPayload, _ := json.Marshal(payload)
resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonPayload))
defer resp.Body.Close()
fmt.Println("Status da Resposta:", resp.Status)
}
Resposta: {"success": true, "slug": "a1b2c3d4", "operation": "update"}
🔹 operation: delete
Remove permanentemente um Pen do sistema.
JSON
cURL
PHP
Node.js
Python
Go
{
"action" : "manage_pens"
"token" : "[SEU_TOKEN]" ,
"operation" : "delete" ,
"slug" : "a1b2c3d4"
}
curl -X POST "https://serverless.crom.me/api/v1" \
-H "Content-Type: application/json" \
-d '{
"action": "manage_pens",
"token": "[SEU_TOKEN]",
"operation": "delete",
"slug": "a1b2c3d4"
}'
<?php
$url = "https://serverless.crom.me/api/v1";
$data = [
"token" => "[SEU_TOKEN]",
"action" => "manage_pens",
"operation" => "delete",
"slug" => "a1b2c3d4"
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
const url = 'https://serverless.crom.me/api/v1';
const data = {
action: 'manage_pens',
token: '[SEU_TOKEN]',
operation: 'delete',
slug: 'a1b2c3d4'
};
fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
})
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));
import requests
url = "https://serverless.crom.me/api/v1"
payload = {
"action": "manage_pens",
"token": "[SEU_TOKEN]",
"operation": "delete",
"slug": "a1b2c3d4"
}
response = requests.post(url, json=payload)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://serverless.crom.me/api/v1"
payload := map[string]interface{}{
"action": "manage_pens",
"token": "[SEU_TOKEN]",
"operation": "delete",
"slug": "a1b2c3d4",
}
jsonPayload, _ := json.Marshal(payload)
resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonPayload))
defer resp.Body.Close()
fmt.Println("Status da Resposta:", resp.Status)
}
Resposta: {"success": true, "slug": "a1b2c3d4", "deleted": 1, "operation": "delete"}