1

I have a requirement wherein I need to call few SAP AIN (Asset Intelligence Network) APIs from a web page. I have created a web page where on a click of a button, I want to call SAP AIN API - lets say to get the count of equipment that I have setup in AIN.

The API URL Provided in the SAP AIN document is:

Application_URL/services/api/v1/equipment/$count

Lets say my AIN application URL is:

https://abcxyz.dispatcher.hana.ondemand.com/sites?hc_reset#Shell-home

I tried below approaches to form API URL:

https://abcxyz.dispatcher.hana.ondemand.com/services/api/v1/equipment/$count -- Did not work

https://abcxyz.dispatcher.hana.ondemand.com/sites/services/api/v1/equipment/$count -- Did not work

https://abcxyz.dispatcher.hana.ondemand.com/sites/services/api/v1/equipment/$count?content-type=application/json -- Did not work

For all above URLs, I am getting Internal 500 error.

  • So what can be the way to form SAP AIN API URL? What am I doing wrong here?
  • Also how do I pass basic authentication like username and password in HttpRequest in Javascript?

Any help would be useful.

4

2 回答 2

1

我自己弄好了。我使用了错误的 API 主机名。

于 2018-04-16T23:21:38.203 回答
0

设备计数的正确 API 端点是:application url++ 。/services/api/v1//equipment/$count

应用程序 URL如下所示:(https://ain.xyz.hana.ondemand.com/ain注意包含的)/ain(请参阅SAP AIN API 教程)。

完整的 API 端点看起来像(替换xyz为您的应用程序)https://ain.xyz.hana.ondemand.com/ain/services/api/v1/equipment/$count:.

有关详细信息,请参阅SAP AIN API 参考,版本 1908。您也可以在SAP API Business Hub for SAP AIN的SAP AIN 设备 API上对此进行测试。

于 2019-09-24T15:03:45.650 回答