如何仅使用api键发布到发布/订阅 [英] How to publish to pub/sub with just an api key

查看:108
本文介绍了如何仅使用api键发布到发布/订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用POST请求将消息发布到GCP发布/订阅,因为我使用的平台(Zoho)不允许使用任何GCP库.我不确定如何以简单的方式发出请求,因为普通的身份验证系统似乎很复杂.

I need to publish messages to GCP Pub/Sub with a POST request as the platform I'm using (Zoho) does not allow for any of the GCP libraries. I'm not sure how to make the request in a simple way, as the normal authentication system seems complex.

  1. 是否有一种简单的方法可以使用例如API密钥发布消息?

  1. Is there an easy way to publish a message using, e.g., an API key?

或者有一种简单的方法可以在GCP中创建一个API端点,然后我可以将其转发到消息传递系统上.

Alternatively is there a simple way to create an API endpoint within GCP that I can then forward data on to the messaging system?

我已经使用python客户端发布到Pub/Sub,但是由于身份验证问题而无法发出POST请求.

I have used the python client to publish to Pub/Sub, but cannot make POST requests because of the authentication issues.

推荐答案

您的两个问题都有相同的答案,是的,Google Cloud Endpoints是您的解决之道.

Both of your questions will have the same answer, yes, and Google Cloud Endpoints is your way to go here.

使用Google Cloud Endpoints,您可以创建自定义终结点并使用API​​密钥来验证正在执行的请求.从中,有一个非常好的操作指南a>您可以按照以下步骤设置端点和发布/订阅推送订阅.

With Google Cloud Endpoints you can create a custom endpoint and use API keys to authenticate the requests that are being done. There's a really good how-to guide from medium you can follow in order to set up your endpoint and your Pub/Sub push subscription.

有关创建推送订阅的更多信息,请参见公共文档.

More information about creating push subscriptions can be found in the public documentation.

这篇关于如何仅使用api键发布到发布/订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆