Node.js SDK
import Migma from 'migma';
const migma = new Migma('YOUR_API_KEY');
const { data, error } = await migma.topics.update('TOPIC_ID', {
name: 'Monthly Digest',
projectId: 'PROJECT_ID'
});curl --request PATCH \
--url https://api.migma.ai/v1/topics/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "<string>",
"name": "<string>",
"description": "<string>",
"displayOrder": 1,
"isActive": true
}
'import requests
url = "https://api.migma.ai/v1/topics/{id}"
payload = {
"projectId": "<string>",
"name": "<string>",
"description": "<string>",
"displayOrder": 1,
"isActive": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.migma.ai/v1/topics/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'projectId' => '<string>',
'name' => '<string>',
'description' => '<string>',
'displayOrder' => 1,
'isActive' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.migma.ai/v1/topics/{id}"
payload := strings.NewReader("{\n \"projectId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"displayOrder\": 1,\n \"isActive\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.patch("https://api.migma.ai/v1/topics/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"displayOrder\": 1,\n \"isActive\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/topics/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"projectId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"displayOrder\": 1,\n \"isActive\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"name": "<string>",
"description": "<string>",
"displayOrder": 123,
"isActive": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"error": "<string>"
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}Update Topic
Update a topic. Note: defaultSubscription cannot be changed after creation. Requires API key with audience:write.
PATCH
/
v1
/
topics
/
{id}
Node.js SDK
import Migma from 'migma';
const migma = new Migma('YOUR_API_KEY');
const { data, error } = await migma.topics.update('TOPIC_ID', {
name: 'Monthly Digest',
projectId: 'PROJECT_ID'
});curl --request PATCH \
--url https://api.migma.ai/v1/topics/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "<string>",
"name": "<string>",
"description": "<string>",
"displayOrder": 1,
"isActive": true
}
'import requests
url = "https://api.migma.ai/v1/topics/{id}"
payload = {
"projectId": "<string>",
"name": "<string>",
"description": "<string>",
"displayOrder": 1,
"isActive": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.migma.ai/v1/topics/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'projectId' => '<string>',
'name' => '<string>',
'description' => '<string>',
'displayOrder' => 1,
'isActive' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.migma.ai/v1/topics/{id}"
payload := strings.NewReader("{\n \"projectId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"displayOrder\": 1,\n \"isActive\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.patch("https://api.migma.ai/v1/topics/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"displayOrder\": 1,\n \"isActive\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/topics/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"projectId\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"displayOrder\": 1,\n \"isActive\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"name": "<string>",
"description": "<string>",
"displayOrder": 123,
"isActive": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"error": "<string>"
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}Authorizations
API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where YOUR_API_KEY is obtained from the Migma dashboard under Settings → Developers → API Keys.
Path Parameters
Topic ID
Body
application/json
Was this page helpful?
⌘I