curl -X POST 'https://api.example.com/api/blog' \
-H 'Authorization: Bearer YOUR_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"userId": "123",
"username": "example_username",
"title": "example_title",
"url": "https://example.com/image.png",
"catId": 123,
"content": "example_content",
"image": "https://example.com/image.png"
}'
const response = await fetch('https://api.example.com/api/blog', {
"method": "POST",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
"body": JSON.stringify({
"userId": "123",
"username": "example_username",
"title": "example_title",
"url": "https://example.com/image.png",
"catId": 123,
"content": "example_content",
"image": "https://example.com/image.png"
})
})
const data = await response.json()
import requests
response = requests.post('https://api.example.com/api/blog', headers={
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
}, json={
"userId": "123",
"username": "example_username",
"title": "example_title",
"url": "https://example.com/image.png",
"catId": 123,
"content": "example_content",
"image": "https://example.com/image.png"
})
data = response.json()
<?php
$context = stream_context_create([
'http' => [
'method' => 'POST',
'header' => "Authorization: Bearer YOUR_API_TOKEN\\r\\nContent-Type: application/json",
'content' => json_encode([
"userId" => "123",
"username" => "example_username",
"title" => "example_title",
"url" => "https://example.com/image.png",
"catId" => 123,
"content" => "example_content",
"image" => "https://example.com/image.png"
])
]
]);
$response = file_get_contents('https://api.example.com/api/blog', false, $context);
$data = json_decode($response, true);