简体   繁体   English

如何使用 WSO2 API 管理器为我们自己的数据库创建 API

[英]How to create an API for our own database using WSO2 API manager

Actually, I want to offer my data from my own database (postgresql) through API.实际上,我想通过 API 从我自己的数据库 (postgresql) 中提供我的数据。 I want to do it using WSO2 API manager.我想使用 WSO2 API 管理器来做到这一点。

I am not sure that I'm doing it in a right way, but suggest me the possibilities.我不确定我是否以正确的方式做这件事,但向我建议可能性。

(i) First I've created a postgresql database. (i) 首先我创建了一个 postgresql 数据库。

(ii) did connections and performed CRUD operation using node js. (ii) 使用 node js 进行连接并执行 CRUD 操作。

(iii) used the link ( for example GET verb and the link is http://localhost:8000/v1/api ) as the REST endpoint in the WSO2 API manager while publishing the api. (iii) 在发布 api 时使用链接(例如 GET 动词,链接是http://localhost:8000/v1/api )作为 WSO2 API 管理器中的 REST 端点。

(iv) *****step******** (iv) *****步骤********

(v) developed a simple html and used Javascript to parse the JSON data and displayed it. (v) 开发了一个简单的 html 并使用 Javascript 来解析 JSON 数据并显示它。 ( but I've done it using direct JSON data not with the WSO2 API) (但我使用直接 JSON 数据而不是 WSO2 API 来完成它)

******step******** ******步********

How to use the consumer key and consumer id to authenticate the API from WSO2 to parse the data through the Javascript如何使用consumer key和consumer id验证来自WSO2的API,通过Javascript解析数据

Since you're new to APIM, you should look at WSO2 tutorials .由于您是 APIM 的新手,您应该查看WSO2 教程

On a related note: You can use WSO2 Data Services Server to expose your data (in a database, for example) as a service (REST or SOAP).相关说明:您可以使用WSO2 数据服务服务器将您的数据(例如在数据库中)作为服务(REST 或 SOAP)公开。 In your case, you can use it instead of your nodejs implementation.在您的情况下,您可以使用它代替 nodejs 实现。 Once you expose your data as a REST services, you can use APIM to front them.一旦您将数据公开为 REST 服务,您就可以使用 APIM 来处理它们。

I think you've to register a new user to your api manager (the user that will use the api), the this user has to subscribe to your api.我认为您必须向您的 api 管理器(将使用 api 的用户)注册一个新用户,该用户必须订阅您的 api。 Once this is done you'll get a token, this token should be provided in the header of your queries (in the js in your case).完成此操作后,您将获得一个令牌,该令牌应在您的查询标题中提供(在您的情况下为 js)。 You can see examples of call when you access your api in the api store.您可以在 api 商店中访问您的 api 时看到调用示例。

Hope it helps希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM