全部产品
云市场

Node使用示例

更新时间:2019-04-30 10:03:02

Node使用示例

需要 Node.js SDK

  1. const ROAClient = require('@alicloud/pop-core').ROAClient;
  2. const client = new ROAClient({
  3. accessKeyId: 'yourAccessKeyID',
  4. accessKeySecret: 'yourAccessKeySecret',
  5. endpoint: 'http://nlp.cn-shanghai.aliyuncs.com',
  6. apiVersion: '2018-04-08',
  7. });
  8. const headers = {
  9. 'content-type': 'application/json',
  10. };
  11. client.request('POST', '/nlp/api/entity/ecommerce', {}, '{"text":"apple"}', headers)
  12. .then((result) => {
  13. console.log(result);
  14. }, (ex) => {
  15. console.log(ex);
  16. });