Send info from Netsuite to Magento Api

2019-09-14 04:38发布

I am trying to send info from Netsuite to Magento, via Magento API. In a normal condition, I execute

    $user       =   'user';
    $pass       =   'password';

    $url        =   'http://example.hosting.com/magento/api/soap/?wsdl';
    $webClient  =   new SoapClient($url);
    $webSession =   $webClient->login($user, $pass);

    $result     =   $webClient->call($webSession, 'ApiMethod', 'data');

Buy I don´t undestand how make it in a Script of Netsuite. I found a method nlapiRequestURL, but I don´t understand how make the login and send the session.

Thanks.

1条回答
时光不老,我们不散
2楼-- · 2019-09-14 05:23

If you are planning on hosting code within NetSuite to talk to Magento, you'd probably be better served using Magento's REST API since it will be much easier to use. Otherwise you'd need a Javascript SOAP client, which isn't part of NetSuite and unlikely to work correctly in that environment.

With the REST API, you basically hit different endpoints for each type of record e.g.

Then you parse your response for the data you need, or post the data you want to create.

查看更多
登录 后发表回答