使用邮递员更新 Contentful 条目 [英] Updating entry of Contentful using postman
问题描述
正如您可以查看下面的屏幕截图,我尝试在 Contentful 中调用 PUT api 以更新条目.
As you can check below screenshot I tried to make PUT api call in the Contentful to update the entry.
当我尝试点击 GET 调用时,一切正常,但不明白在进行 PUT 调用时出现以下错误的原因是什么.
When I try to hit GET call, everything works fine but don't understand here what is reason of this below error while making PUT call.
我在这里遗漏了什么或在这里做错了什么吗?
Did I missed anything here or anything wrong here?
注意:我在调用时更改了所有变量、spaceId、env、entryId 和授权(传递 access_token)
NOTE: I changed all the variable while making call, spaceId, env, entryId and authorisation(passing access_token)
推荐答案
从我在您的 URL 中看到的内容来看,您似乎正在尝试访问只读的 Contentful Preview API
.
From what I see in your URL, it looks like you are trying to hit the Contentful Preview API
, which is read-only.
API 基本 URL https://preview.contentful.com这是一个只读 API
API Base URL https://preview.contentful.com This is a read-only API
因此,无法使用您正在使用的 URL 通过 PUT
请求更新条目.
Therefore, updating an entry via a PUT
request cannot be done with the url you are using.
但是,如果您将基本 url 更新为 https://api.contentful.com/
,我相信您的 PUT
请求应该可以工作.这是 Content Management API
的端点.
However, I believe your PUT
request should work if you update the base url to be https://api.contentful.com/
instead. This is the endpoint for the Content Management API
.
重要提示:
- 如果您这样做,您将需要使用 不同的身份验证令牌.
- if you do this, you will need to use a different auth token for the
Content Management API
.
使用 https://api.contentful.com/
命中可写的 Content Management API
,它具有 文档 PUT
您正在发出的请求.
Using https://api.contentful.com/
hits the writable Content Management API
, which has documentation for the PUT
request you are making.
导入对应的curl
命令进入您的 Postman 客户端将确认这一点.
Importing the corresponding curl
command into your Postman client will confirm this.
最后,网址是这样的:
https://api.contentful.com/spaces/{space_id}/environments/{environment_id}/entries/{entry_id}
同样,不记名令牌必须来自可写的内容管理 API.
Again, the bearer token will have to come from the writable Content Management API.
这篇关于使用邮递员更新 Contentful 条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!