メインコンテンツへスキップ
PUT
/
blogs
/
v3
/
topics
/
{topic-id}
Update a blog topic
curl --request PUT \
  --url https://api.hubapi.com/blogs/v3/topics/{topic-id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Hey an updated Topic",
  "description": "This is an updated topic description"
}
'
import requests

url = "https://api.hubapi.com/blogs/v3/topics/{topic-id}"

payload = {
    "name": "Hey an updated Topic",
    "description": "This is an updated topic description"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    name: 'Hey an updated Topic',
    description: 'This is an updated topic description'
  })
};

fetch('https://api.hubapi.com/blogs/v3/topics/{topic-id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.hubapi.com/blogs/v3/topics/{topic-id}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => json_encode([
    'name' => 'Hey an updated Topic',
    'description' => 'This is an updated topic description'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.hubapi.com/blogs/v3/topics/{topic-id}"

	payload := strings.NewReader("{\n  \"name\": \"Hey an updated Topic\",\n  \"description\": \"This is an updated topic description\"\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://api.hubapi.com/blogs/v3/topics/{topic-id}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Hey an updated Topic\",\n  \"description\": \"This is an updated topic description\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.hubapi.com/blogs/v3/topics/{topic-id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Hey an updated Topic\",\n  \"description\": \"This is an updated topic description\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": 349001123123123,
  "portalId": 62515,
  "name": "Hey an updated topic",
  "slug": "hey-an-updated-topic",
  "description": "This is an updated topic description",
  "created": 1381896200000,
  "updated": 1381896200000,
  "deletedAt": 0,
  "totalPosts": null,
  "livePosts": null,
  "lastUsed": null,
  "associatedBlogIds": [],
  "publicUrl": null,
  "status": "inactive"
}
{
  "message": "<string>",
  "correlationId": "<string>",
  "category": "<string>",
  "links": {}
}

承認

Authorization
string
header
必須

The access token received from the authorization server in the OAuth 2.0 flow.

パスパラメータ

topic-id
string
必須

Unique identifier for a particular topic

クエリパラメータ

casing
enum<string>

Use the casing=snake parameter to change the API's casing for returned JSON fields (below) to snake_case, rather than camelCase, which is the default. This option is provided for backwards-compatibility and ease of migration from Content v2 APIs, which used snake_case.

利用可能なオプション:
snake

ボディ

application/json
name
string

The topic name

description
string

The topic description

レスポンス

successful operation

id
integer<int64>

The unique id of the topic

portalId
integer

The hub id

name
string

The topic name

slug
string

The URL-friendly version of the topic, used in blog urls

description
string

The topic description

created
integer<int64>

When the topic was first created, in milliseconds since the epoch

updated
integer<int64>

When the topic was last updated, in milliseconds since the epoch

deletedAt
integer<int64>

When the topic was deleted, in milliseconds since the epoch. Zero if the topic was never deleted. Use a DELETE request to properly soft delete a topic - do not set this value directly.

totalPosts
integer | null

The total count of posts (including drafts) associated with this topic.

livePosts
integer | null

The total count of published posts associated with this topic.

lastUsed
integer<int64> | null

The most recent publish date of a blog post associated with this topic, in milliseconds since the epoch.

associatedBlogIds
integer[]

A list of the blog IDs where this topic has been used.

publicUrl
string | null

The public URL for the topic

status
string

The status of the topic

最終更新日 2026年4月10日