简体   繁体   中英

How to get data from netsuite rest web services using node js?

我是一名初级程序员,我想从 netsuite 获取数据并将其显示在控制台上...我不明白如何使用 node js 从 netsuite 获取它,请帮我解决这个问题或至少推荐一个教程这样做?

There's a sample at Netsuite OAuth Not Working of how to connect from node.

And here is a super simple RESTlet:

/**
 *@NApiVersion 2.x
 *@NScriptType Restlet
 */
define(['N/search', 'N/error'], function(search, error){
    function getSearch(){
        var itemSearches = search.create({
            type: 'search',
            filters:[
                'type', 'is', 'item'
            ],
            columns :[
                'title'
            ]});
        var availSearches = [];
        return itemSearches.run().each(function(srch){
            availSearches.push({
                id : srch.id,
                type: srch.recordType,
                title : srch.getValue('title')
            });
        });

    }
    return {
        get:getSearch
    };
});

In order to call the RESTlet from Node your Node needs:

  • Consumer Key and Secret which you get from setting up an integration
  • token key and secret which you get from getting a user token for a user with a role to which the Restlet is Audienced.

Made a library for this some time ago. It's not maintained but afaik it still works..

https://github.com/felipechang/node-suitetalk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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