You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Pulsar Admin Rest API获取sample/standalone/ns1命名空间策略遇405错误求解

Fixing 405 Method Not Allowed for Pulsar Admin API on sample/standalone/ns1

The 405 error you’re hitting boils down to how URL path separators clash with Pulsar’s hierarchical namespace naming. Let’s break this down and get it fixed:

Why the error happens

When you send a request to /admin/v2/namespaces/sample/standalone/ns1, the Pulsar API misinterprets the path structure:

  • It reads sample as the tenant (correct)
  • It reads standalone as the full namespace (wrong)
  • It sees ns1 as an extra, unrecognized path segment

Since there’s no API endpoint that matches /admin/v2/namespaces/{tenant}/{namespace}/{extra}, the server returns a 405 Method Not Allowed (a common fallback when the requested path doesn’t map to any valid endpoint).

Your core understanding of the tenant/namespace split is correct (sample is the tenant, standalone/ns1 is the namespace) — the problem is that the slash in standalone/ns1 is being treated as a URL path divider instead of part of the namespace name.

How to fix it

You need to URL-encode the slash (/) in the namespace name as %2F. This tells the API that the slash is part of the namespace parameter, not a path separator.

Correct API URL

Use this formatted URL instead:

/admin/v2/namespaces/sample/standalone%2Fns1

Double-check your HTTP method

Make sure you’re using the GET method (required for fetching namespace policies). Since your request to public/default works, your method is likely correct — but it’s worth confirming you didn’t accidentally use POST/PUT/DELETE for the sample/standalone/ns1 request.

Example working curl command

Here’s a quick test to validate the fix:

curl -X GET http://your-pulsar-admin-host:8080/admin/v2/namespaces/sample/standalone%2Fns1

This should return the namespace policies for sample/standalone/ns1 without the 405 error.

内容的提问来源于stack exchange,提问作者NickNgn

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 09:25:01