35
Copyright 2018 Advantech Co. Ltd. All rights reserved. SERVER IMANAGER HEALTH GUARD RESTFUL API PROGRAMMING GUIDE REVISION 3.0 DATE 2020/6/05

RESTFUL API PROGRAMMING GUIDE - Advantech

  • Upload
    others

  • View
    43

  • Download
    0

Embed Size (px)

Citation preview

Page 1: RESTFUL API PROGRAMMING GUIDE - Advantech

Copyright 2018 Advantech Co Ltd All rights reserved

SERVER IMANAGER ndash HEALTH GUARD

RESTFUL API PROGRAMMING GUIDE

REVISION 30 DATE 2020605

Advantech Server iManager RESTful API Programming Guide Page 1

Revision History

Date [mmddyyyy]

Revision Modifications

10192018 01 Initial version based on software package version 008

11132018 10 Finalize formatting and release

07122019 11 Fix RESTful API URL for Health Guard v012

08272019 20 Edition 2 release

12202019 21 Add restart API

05072020 22 Add sysinfo API

06052020 30 Official release

copy Copyright 2018-2019 Advantech Co Ltd

All Rights Reserved

Advantech Co Ltd reserves the right to make improvements in the products described in this manual at any time without notice No part of this manual may be reproduced copied translated or transmitted in any form or by any means without the prior written permission of Advantech Co Ltd Information provided in this manual is intended to be accurate and

Advantech Server iManager RESTful API Programming Guide Page 2

reliable However Advantech Co Ltd assumes no responsibility for its use nor for any infringements of the rights of third parties which may result from its use

Advantech Server iManager RESTful API Programming Guide Page 3

About This Manual

The target audience of this manual includes users developers and technicians This document describes the features functions and operations of Server iManager RESTful API

This manual is organized as follows

Section 1 gives an overview of the Server iManager RESTful API

Section 2 introduces the URIs and functions available in the Server iManager RESTful API

This document covers

Server iManager version 012 and later

Useful Documents

If you cannot find the information you are looking for or need more detailed information on a specific topic please refer to the following documents and information sources Should you require any assistance with obtaining these documents or if still cannot find what you are looking for please contact your Advantech representative

Server iManager user manual can be found at Server_iManager-HealthGuard_User_Manual_v300

Advantech Server iManager RESTful API Programming Guide Page 4

Warnings Cautions and Notes

Warning Warnings indicate conditions which if not observed can cause personal injury

Caution Cautions are included to help you avoid damaging your hardware or losing data

Note Notes provide additional information

We appreciate your input Please let us know of any aspect of this productmdashincluding this manualmdashthat could use improvement or correction We appreciate your valuable input in helping make our products and documentation better

Please send any related feedback to tsencgadvantechcom

Advantech Server iManager RESTful API Programming Guide Page 5

Table of Contents

INTRODUCTION 9

SERVER IMANAGER RESTFUL API 10

21 URL STRUCTURE 10

22 AUTHENTICATION amp LOGIN API 10

23 LIST API 11

24 CONFIG API 12

Get Config 12 Update Config 14 Test Config 16

25 COLLECTOR API 17

26 STATUS API 19

27 EVENT API 21

Get Event 21 Clear Event 22

28 SUMMARY API 23

29 RESTART API 24

210 SYSTEM INFORMATION API 24

211 DIAGNOSTIC API 25

List 25 Info 26 Result 27 Log 29 Start 31 Stop 32 Status 33

Advantech Server iManager RESTful API Programming Guide Page 6

List of Tables Table 1 Descriptions for login API parameters 10

Table 2 Descriptions of login API response 11

Table 3 Descriptions for list API parameters 11

Table 4 Descriptions of list API response 12

Table 5 Descriptions of get config API response 13

Table 6 Descriptions for update config API parameters 14

Table 7 Descriptions of update config API response 15

Table 8 Descriptions of test config API response 17

Table 9 Descriptions for collector API parameters 17

Table 10 Descriptions of collector API response 18

Table 11 Descriptions for status API parameters 19

Table 12 Descriptions of status API response 19

Table 13 Descriptions for get event API parameters 21

Table 14 Descriptions of get event API response 22

Table 15 Descriptions of clear event API response 22

Table 16 Descriptions of summary API response 23

Table 17 Descriptions of restart API response 24

Table 18 Descriptions of sysinfo API response 25

Table 19 Descriptions of list API response 26

Table 20 Descriptions for info API parameters 26

Table 21 Descriptions of info API response 27

Table 22 Descriptions for result API parameters 28

Table 23 Descriptions of result API response 28

Table 24 Descriptions for log API parameters 29

Table 25 Descriptions of log API response 29

Table 26 Descriptions for start API parameters 31

Table 27 Descriptions of start API response 32

Table 28 Descriptions for stop API parameters 32

Table 29 Descriptions of stop API response 33

Table 30 Descriptions for status API parameters 33

Table 31 Descriptions of status API response 34

Advantech Server iManager RESTful API Programming Guide Page 7

Advantech Server iManager RESTful API Programming Guide Page 8

Glossary

CLI Command-line interface

HTTP Hypertext Transfer Protocol

REST Representational state transfer

URL Uniform resource locator

Advantech Server iManager RESTful API Programming Guide Page 9

INTRODUCTION

This document describes the REST (Representation State Transfer) interface for Server iManager REST is a set of constraints for architectures that typically communicate over HTTP

Server iManager RESTful APIs provide services for the CLI utility to access the data of collector config summary and diagnostic framework modules

Advantech Server iManager RESTful API Programming Guide Page 10

SERVER IMANAGER RESTFUL API

21 URL Structure

Access to resources is provided via URL paths Client applications should send requests over the HTTP protocol using standard GET POST PUT and DELETE methods

Server iManager URL structure

[protocol][host][port]api[resource name]

where

[protocol] = the communication protocol (HTTP)

[host] = the host machine IP address where Server iManager service is running

[port] = the port number on which Server iManager service is listening

[resource name] = the name of the resource to be returned

For information on the host and port please refer to Server iManager user manual

22 Authentication amp login API

For remote access you need to login to get an authentication token which is required for each remote access request The login API provides JWT token-based authentication for the RESTful API

Syntax

HTTP Method POST

URI apilogin

Parameters

Parameter Content Type ApplicationJSON

Name Description

body Required

username admin

password advantech

Table 1 Descriptions for login API parameters

Advantech Server iManager RESTful API Programming Guide Page 11

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

token XVCJ9123eyJle456 3zQ3zRQ789

401 Not authorized

Example value

Error Not Authorized

Table 2 Descriptions of login API response

Example curl command

curl -X POST -d username admin password advantech -H Content-Typeapplicationjson http1721710648087apilogin

23 List API

The List API lists all of the RESTful APIs supported by Server iManager

Syntax

HTTP Method GET

URI api

Parameters

Name Description

NA NA

Table 3 Descriptions for list API parameters

Advantech Server iManager RESTful API Programming Guide Page 12

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

config_url http [host][port]apiconfig

login_url http [host][port]apilogin

Table 4 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087api

Example curl command from local side

curl http1270018087api

24 Config API

Get Config

The Get Config API gets all of the data from the config file It shows the password as in order to maintain security

Syntax

HTTP Method GET

URI apiconfig

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

Advantech Server iManager RESTful API Programming Guide Page 13

collector

interval 20s

mce 1

network 1

pcie 1

sensor 1

storage 1

log

level info

max-days 10

max-size 102400000

path varlogahg

Table 5 Descriptions of get config API response

Example curl command from the remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfig

Example curl command from the local side

curl http1270018087apiconfig

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 2: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 1

Revision History

Date [mmddyyyy]

Revision Modifications

10192018 01 Initial version based on software package version 008

11132018 10 Finalize formatting and release

07122019 11 Fix RESTful API URL for Health Guard v012

08272019 20 Edition 2 release

12202019 21 Add restart API

05072020 22 Add sysinfo API

06052020 30 Official release

copy Copyright 2018-2019 Advantech Co Ltd

All Rights Reserved

Advantech Co Ltd reserves the right to make improvements in the products described in this manual at any time without notice No part of this manual may be reproduced copied translated or transmitted in any form or by any means without the prior written permission of Advantech Co Ltd Information provided in this manual is intended to be accurate and

Advantech Server iManager RESTful API Programming Guide Page 2

reliable However Advantech Co Ltd assumes no responsibility for its use nor for any infringements of the rights of third parties which may result from its use

Advantech Server iManager RESTful API Programming Guide Page 3

About This Manual

The target audience of this manual includes users developers and technicians This document describes the features functions and operations of Server iManager RESTful API

This manual is organized as follows

Section 1 gives an overview of the Server iManager RESTful API

Section 2 introduces the URIs and functions available in the Server iManager RESTful API

This document covers

Server iManager version 012 and later

Useful Documents

If you cannot find the information you are looking for or need more detailed information on a specific topic please refer to the following documents and information sources Should you require any assistance with obtaining these documents or if still cannot find what you are looking for please contact your Advantech representative

Server iManager user manual can be found at Server_iManager-HealthGuard_User_Manual_v300

Advantech Server iManager RESTful API Programming Guide Page 4

Warnings Cautions and Notes

Warning Warnings indicate conditions which if not observed can cause personal injury

Caution Cautions are included to help you avoid damaging your hardware or losing data

Note Notes provide additional information

We appreciate your input Please let us know of any aspect of this productmdashincluding this manualmdashthat could use improvement or correction We appreciate your valuable input in helping make our products and documentation better

Please send any related feedback to tsencgadvantechcom

Advantech Server iManager RESTful API Programming Guide Page 5

Table of Contents

INTRODUCTION 9

SERVER IMANAGER RESTFUL API 10

21 URL STRUCTURE 10

22 AUTHENTICATION amp LOGIN API 10

23 LIST API 11

24 CONFIG API 12

Get Config 12 Update Config 14 Test Config 16

25 COLLECTOR API 17

26 STATUS API 19

27 EVENT API 21

Get Event 21 Clear Event 22

28 SUMMARY API 23

29 RESTART API 24

210 SYSTEM INFORMATION API 24

211 DIAGNOSTIC API 25

List 25 Info 26 Result 27 Log 29 Start 31 Stop 32 Status 33

Advantech Server iManager RESTful API Programming Guide Page 6

List of Tables Table 1 Descriptions for login API parameters 10

Table 2 Descriptions of login API response 11

Table 3 Descriptions for list API parameters 11

Table 4 Descriptions of list API response 12

Table 5 Descriptions of get config API response 13

Table 6 Descriptions for update config API parameters 14

Table 7 Descriptions of update config API response 15

Table 8 Descriptions of test config API response 17

Table 9 Descriptions for collector API parameters 17

Table 10 Descriptions of collector API response 18

Table 11 Descriptions for status API parameters 19

Table 12 Descriptions of status API response 19

Table 13 Descriptions for get event API parameters 21

Table 14 Descriptions of get event API response 22

Table 15 Descriptions of clear event API response 22

Table 16 Descriptions of summary API response 23

Table 17 Descriptions of restart API response 24

Table 18 Descriptions of sysinfo API response 25

Table 19 Descriptions of list API response 26

Table 20 Descriptions for info API parameters 26

Table 21 Descriptions of info API response 27

Table 22 Descriptions for result API parameters 28

Table 23 Descriptions of result API response 28

Table 24 Descriptions for log API parameters 29

Table 25 Descriptions of log API response 29

Table 26 Descriptions for start API parameters 31

Table 27 Descriptions of start API response 32

Table 28 Descriptions for stop API parameters 32

Table 29 Descriptions of stop API response 33

Table 30 Descriptions for status API parameters 33

Table 31 Descriptions of status API response 34

Advantech Server iManager RESTful API Programming Guide Page 7

Advantech Server iManager RESTful API Programming Guide Page 8

Glossary

CLI Command-line interface

HTTP Hypertext Transfer Protocol

REST Representational state transfer

URL Uniform resource locator

Advantech Server iManager RESTful API Programming Guide Page 9

INTRODUCTION

This document describes the REST (Representation State Transfer) interface for Server iManager REST is a set of constraints for architectures that typically communicate over HTTP

Server iManager RESTful APIs provide services for the CLI utility to access the data of collector config summary and diagnostic framework modules

Advantech Server iManager RESTful API Programming Guide Page 10

SERVER IMANAGER RESTFUL API

21 URL Structure

Access to resources is provided via URL paths Client applications should send requests over the HTTP protocol using standard GET POST PUT and DELETE methods

Server iManager URL structure

[protocol][host][port]api[resource name]

where

[protocol] = the communication protocol (HTTP)

[host] = the host machine IP address where Server iManager service is running

[port] = the port number on which Server iManager service is listening

[resource name] = the name of the resource to be returned

For information on the host and port please refer to Server iManager user manual

22 Authentication amp login API

For remote access you need to login to get an authentication token which is required for each remote access request The login API provides JWT token-based authentication for the RESTful API

Syntax

HTTP Method POST

URI apilogin

Parameters

Parameter Content Type ApplicationJSON

Name Description

body Required

username admin

password advantech

Table 1 Descriptions for login API parameters

Advantech Server iManager RESTful API Programming Guide Page 11

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

token XVCJ9123eyJle456 3zQ3zRQ789

401 Not authorized

Example value

Error Not Authorized

Table 2 Descriptions of login API response

Example curl command

curl -X POST -d username admin password advantech -H Content-Typeapplicationjson http1721710648087apilogin

23 List API

The List API lists all of the RESTful APIs supported by Server iManager

Syntax

HTTP Method GET

URI api

Parameters

Name Description

NA NA

Table 3 Descriptions for list API parameters

Advantech Server iManager RESTful API Programming Guide Page 12

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

config_url http [host][port]apiconfig

login_url http [host][port]apilogin

Table 4 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087api

Example curl command from local side

curl http1270018087api

24 Config API

Get Config

The Get Config API gets all of the data from the config file It shows the password as in order to maintain security

Syntax

HTTP Method GET

URI apiconfig

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

Advantech Server iManager RESTful API Programming Guide Page 13

collector

interval 20s

mce 1

network 1

pcie 1

sensor 1

storage 1

log

level info

max-days 10

max-size 102400000

path varlogahg

Table 5 Descriptions of get config API response

Example curl command from the remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfig

Example curl command from the local side

curl http1270018087apiconfig

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 3: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 2

reliable However Advantech Co Ltd assumes no responsibility for its use nor for any infringements of the rights of third parties which may result from its use

Advantech Server iManager RESTful API Programming Guide Page 3

About This Manual

The target audience of this manual includes users developers and technicians This document describes the features functions and operations of Server iManager RESTful API

This manual is organized as follows

Section 1 gives an overview of the Server iManager RESTful API

Section 2 introduces the URIs and functions available in the Server iManager RESTful API

This document covers

Server iManager version 012 and later

Useful Documents

If you cannot find the information you are looking for or need more detailed information on a specific topic please refer to the following documents and information sources Should you require any assistance with obtaining these documents or if still cannot find what you are looking for please contact your Advantech representative

Server iManager user manual can be found at Server_iManager-HealthGuard_User_Manual_v300

Advantech Server iManager RESTful API Programming Guide Page 4

Warnings Cautions and Notes

Warning Warnings indicate conditions which if not observed can cause personal injury

Caution Cautions are included to help you avoid damaging your hardware or losing data

Note Notes provide additional information

We appreciate your input Please let us know of any aspect of this productmdashincluding this manualmdashthat could use improvement or correction We appreciate your valuable input in helping make our products and documentation better

Please send any related feedback to tsencgadvantechcom

Advantech Server iManager RESTful API Programming Guide Page 5

Table of Contents

INTRODUCTION 9

SERVER IMANAGER RESTFUL API 10

21 URL STRUCTURE 10

22 AUTHENTICATION amp LOGIN API 10

23 LIST API 11

24 CONFIG API 12

Get Config 12 Update Config 14 Test Config 16

25 COLLECTOR API 17

26 STATUS API 19

27 EVENT API 21

Get Event 21 Clear Event 22

28 SUMMARY API 23

29 RESTART API 24

210 SYSTEM INFORMATION API 24

211 DIAGNOSTIC API 25

List 25 Info 26 Result 27 Log 29 Start 31 Stop 32 Status 33

Advantech Server iManager RESTful API Programming Guide Page 6

List of Tables Table 1 Descriptions for login API parameters 10

Table 2 Descriptions of login API response 11

Table 3 Descriptions for list API parameters 11

Table 4 Descriptions of list API response 12

Table 5 Descriptions of get config API response 13

Table 6 Descriptions for update config API parameters 14

Table 7 Descriptions of update config API response 15

Table 8 Descriptions of test config API response 17

Table 9 Descriptions for collector API parameters 17

Table 10 Descriptions of collector API response 18

Table 11 Descriptions for status API parameters 19

Table 12 Descriptions of status API response 19

Table 13 Descriptions for get event API parameters 21

Table 14 Descriptions of get event API response 22

Table 15 Descriptions of clear event API response 22

Table 16 Descriptions of summary API response 23

Table 17 Descriptions of restart API response 24

Table 18 Descriptions of sysinfo API response 25

Table 19 Descriptions of list API response 26

Table 20 Descriptions for info API parameters 26

Table 21 Descriptions of info API response 27

Table 22 Descriptions for result API parameters 28

Table 23 Descriptions of result API response 28

Table 24 Descriptions for log API parameters 29

Table 25 Descriptions of log API response 29

Table 26 Descriptions for start API parameters 31

Table 27 Descriptions of start API response 32

Table 28 Descriptions for stop API parameters 32

Table 29 Descriptions of stop API response 33

Table 30 Descriptions for status API parameters 33

Table 31 Descriptions of status API response 34

Advantech Server iManager RESTful API Programming Guide Page 7

Advantech Server iManager RESTful API Programming Guide Page 8

Glossary

CLI Command-line interface

HTTP Hypertext Transfer Protocol

REST Representational state transfer

URL Uniform resource locator

Advantech Server iManager RESTful API Programming Guide Page 9

INTRODUCTION

This document describes the REST (Representation State Transfer) interface for Server iManager REST is a set of constraints for architectures that typically communicate over HTTP

Server iManager RESTful APIs provide services for the CLI utility to access the data of collector config summary and diagnostic framework modules

Advantech Server iManager RESTful API Programming Guide Page 10

SERVER IMANAGER RESTFUL API

21 URL Structure

Access to resources is provided via URL paths Client applications should send requests over the HTTP protocol using standard GET POST PUT and DELETE methods

Server iManager URL structure

[protocol][host][port]api[resource name]

where

[protocol] = the communication protocol (HTTP)

[host] = the host machine IP address where Server iManager service is running

[port] = the port number on which Server iManager service is listening

[resource name] = the name of the resource to be returned

For information on the host and port please refer to Server iManager user manual

22 Authentication amp login API

For remote access you need to login to get an authentication token which is required for each remote access request The login API provides JWT token-based authentication for the RESTful API

Syntax

HTTP Method POST

URI apilogin

Parameters

Parameter Content Type ApplicationJSON

Name Description

body Required

username admin

password advantech

Table 1 Descriptions for login API parameters

Advantech Server iManager RESTful API Programming Guide Page 11

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

token XVCJ9123eyJle456 3zQ3zRQ789

401 Not authorized

Example value

Error Not Authorized

Table 2 Descriptions of login API response

Example curl command

curl -X POST -d username admin password advantech -H Content-Typeapplicationjson http1721710648087apilogin

23 List API

The List API lists all of the RESTful APIs supported by Server iManager

Syntax

HTTP Method GET

URI api

Parameters

Name Description

NA NA

Table 3 Descriptions for list API parameters

Advantech Server iManager RESTful API Programming Guide Page 12

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

config_url http [host][port]apiconfig

login_url http [host][port]apilogin

Table 4 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087api

Example curl command from local side

curl http1270018087api

24 Config API

Get Config

The Get Config API gets all of the data from the config file It shows the password as in order to maintain security

Syntax

HTTP Method GET

URI apiconfig

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

Advantech Server iManager RESTful API Programming Guide Page 13

collector

interval 20s

mce 1

network 1

pcie 1

sensor 1

storage 1

log

level info

max-days 10

max-size 102400000

path varlogahg

Table 5 Descriptions of get config API response

Example curl command from the remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfig

Example curl command from the local side

curl http1270018087apiconfig

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 4: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 3

About This Manual

The target audience of this manual includes users developers and technicians This document describes the features functions and operations of Server iManager RESTful API

This manual is organized as follows

Section 1 gives an overview of the Server iManager RESTful API

Section 2 introduces the URIs and functions available in the Server iManager RESTful API

This document covers

Server iManager version 012 and later

Useful Documents

If you cannot find the information you are looking for or need more detailed information on a specific topic please refer to the following documents and information sources Should you require any assistance with obtaining these documents or if still cannot find what you are looking for please contact your Advantech representative

Server iManager user manual can be found at Server_iManager-HealthGuard_User_Manual_v300

Advantech Server iManager RESTful API Programming Guide Page 4

Warnings Cautions and Notes

Warning Warnings indicate conditions which if not observed can cause personal injury

Caution Cautions are included to help you avoid damaging your hardware or losing data

Note Notes provide additional information

We appreciate your input Please let us know of any aspect of this productmdashincluding this manualmdashthat could use improvement or correction We appreciate your valuable input in helping make our products and documentation better

Please send any related feedback to tsencgadvantechcom

Advantech Server iManager RESTful API Programming Guide Page 5

Table of Contents

INTRODUCTION 9

SERVER IMANAGER RESTFUL API 10

21 URL STRUCTURE 10

22 AUTHENTICATION amp LOGIN API 10

23 LIST API 11

24 CONFIG API 12

Get Config 12 Update Config 14 Test Config 16

25 COLLECTOR API 17

26 STATUS API 19

27 EVENT API 21

Get Event 21 Clear Event 22

28 SUMMARY API 23

29 RESTART API 24

210 SYSTEM INFORMATION API 24

211 DIAGNOSTIC API 25

List 25 Info 26 Result 27 Log 29 Start 31 Stop 32 Status 33

Advantech Server iManager RESTful API Programming Guide Page 6

List of Tables Table 1 Descriptions for login API parameters 10

Table 2 Descriptions of login API response 11

Table 3 Descriptions for list API parameters 11

Table 4 Descriptions of list API response 12

Table 5 Descriptions of get config API response 13

Table 6 Descriptions for update config API parameters 14

Table 7 Descriptions of update config API response 15

Table 8 Descriptions of test config API response 17

Table 9 Descriptions for collector API parameters 17

Table 10 Descriptions of collector API response 18

Table 11 Descriptions for status API parameters 19

Table 12 Descriptions of status API response 19

Table 13 Descriptions for get event API parameters 21

Table 14 Descriptions of get event API response 22

Table 15 Descriptions of clear event API response 22

Table 16 Descriptions of summary API response 23

Table 17 Descriptions of restart API response 24

Table 18 Descriptions of sysinfo API response 25

Table 19 Descriptions of list API response 26

Table 20 Descriptions for info API parameters 26

Table 21 Descriptions of info API response 27

Table 22 Descriptions for result API parameters 28

Table 23 Descriptions of result API response 28

Table 24 Descriptions for log API parameters 29

Table 25 Descriptions of log API response 29

Table 26 Descriptions for start API parameters 31

Table 27 Descriptions of start API response 32

Table 28 Descriptions for stop API parameters 32

Table 29 Descriptions of stop API response 33

Table 30 Descriptions for status API parameters 33

Table 31 Descriptions of status API response 34

Advantech Server iManager RESTful API Programming Guide Page 7

Advantech Server iManager RESTful API Programming Guide Page 8

Glossary

CLI Command-line interface

HTTP Hypertext Transfer Protocol

REST Representational state transfer

URL Uniform resource locator

Advantech Server iManager RESTful API Programming Guide Page 9

INTRODUCTION

This document describes the REST (Representation State Transfer) interface for Server iManager REST is a set of constraints for architectures that typically communicate over HTTP

Server iManager RESTful APIs provide services for the CLI utility to access the data of collector config summary and diagnostic framework modules

Advantech Server iManager RESTful API Programming Guide Page 10

SERVER IMANAGER RESTFUL API

21 URL Structure

Access to resources is provided via URL paths Client applications should send requests over the HTTP protocol using standard GET POST PUT and DELETE methods

Server iManager URL structure

[protocol][host][port]api[resource name]

where

[protocol] = the communication protocol (HTTP)

[host] = the host machine IP address where Server iManager service is running

[port] = the port number on which Server iManager service is listening

[resource name] = the name of the resource to be returned

For information on the host and port please refer to Server iManager user manual

22 Authentication amp login API

For remote access you need to login to get an authentication token which is required for each remote access request The login API provides JWT token-based authentication for the RESTful API

Syntax

HTTP Method POST

URI apilogin

Parameters

Parameter Content Type ApplicationJSON

Name Description

body Required

username admin

password advantech

Table 1 Descriptions for login API parameters

Advantech Server iManager RESTful API Programming Guide Page 11

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

token XVCJ9123eyJle456 3zQ3zRQ789

401 Not authorized

Example value

Error Not Authorized

Table 2 Descriptions of login API response

Example curl command

curl -X POST -d username admin password advantech -H Content-Typeapplicationjson http1721710648087apilogin

23 List API

The List API lists all of the RESTful APIs supported by Server iManager

Syntax

HTTP Method GET

URI api

Parameters

Name Description

NA NA

Table 3 Descriptions for list API parameters

Advantech Server iManager RESTful API Programming Guide Page 12

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

config_url http [host][port]apiconfig

login_url http [host][port]apilogin

Table 4 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087api

Example curl command from local side

curl http1270018087api

24 Config API

Get Config

The Get Config API gets all of the data from the config file It shows the password as in order to maintain security

Syntax

HTTP Method GET

URI apiconfig

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

Advantech Server iManager RESTful API Programming Guide Page 13

collector

interval 20s

mce 1

network 1

pcie 1

sensor 1

storage 1

log

level info

max-days 10

max-size 102400000

path varlogahg

Table 5 Descriptions of get config API response

Example curl command from the remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfig

Example curl command from the local side

curl http1270018087apiconfig

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 5: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 4

Warnings Cautions and Notes

Warning Warnings indicate conditions which if not observed can cause personal injury

Caution Cautions are included to help you avoid damaging your hardware or losing data

Note Notes provide additional information

We appreciate your input Please let us know of any aspect of this productmdashincluding this manualmdashthat could use improvement or correction We appreciate your valuable input in helping make our products and documentation better

Please send any related feedback to tsencgadvantechcom

Advantech Server iManager RESTful API Programming Guide Page 5

Table of Contents

INTRODUCTION 9

SERVER IMANAGER RESTFUL API 10

21 URL STRUCTURE 10

22 AUTHENTICATION amp LOGIN API 10

23 LIST API 11

24 CONFIG API 12

Get Config 12 Update Config 14 Test Config 16

25 COLLECTOR API 17

26 STATUS API 19

27 EVENT API 21

Get Event 21 Clear Event 22

28 SUMMARY API 23

29 RESTART API 24

210 SYSTEM INFORMATION API 24

211 DIAGNOSTIC API 25

List 25 Info 26 Result 27 Log 29 Start 31 Stop 32 Status 33

Advantech Server iManager RESTful API Programming Guide Page 6

List of Tables Table 1 Descriptions for login API parameters 10

Table 2 Descriptions of login API response 11

Table 3 Descriptions for list API parameters 11

Table 4 Descriptions of list API response 12

Table 5 Descriptions of get config API response 13

Table 6 Descriptions for update config API parameters 14

Table 7 Descriptions of update config API response 15

Table 8 Descriptions of test config API response 17

Table 9 Descriptions for collector API parameters 17

Table 10 Descriptions of collector API response 18

Table 11 Descriptions for status API parameters 19

Table 12 Descriptions of status API response 19

Table 13 Descriptions for get event API parameters 21

Table 14 Descriptions of get event API response 22

Table 15 Descriptions of clear event API response 22

Table 16 Descriptions of summary API response 23

Table 17 Descriptions of restart API response 24

Table 18 Descriptions of sysinfo API response 25

Table 19 Descriptions of list API response 26

Table 20 Descriptions for info API parameters 26

Table 21 Descriptions of info API response 27

Table 22 Descriptions for result API parameters 28

Table 23 Descriptions of result API response 28

Table 24 Descriptions for log API parameters 29

Table 25 Descriptions of log API response 29

Table 26 Descriptions for start API parameters 31

Table 27 Descriptions of start API response 32

Table 28 Descriptions for stop API parameters 32

Table 29 Descriptions of stop API response 33

Table 30 Descriptions for status API parameters 33

Table 31 Descriptions of status API response 34

Advantech Server iManager RESTful API Programming Guide Page 7

Advantech Server iManager RESTful API Programming Guide Page 8

Glossary

CLI Command-line interface

HTTP Hypertext Transfer Protocol

REST Representational state transfer

URL Uniform resource locator

Advantech Server iManager RESTful API Programming Guide Page 9

INTRODUCTION

This document describes the REST (Representation State Transfer) interface for Server iManager REST is a set of constraints for architectures that typically communicate over HTTP

Server iManager RESTful APIs provide services for the CLI utility to access the data of collector config summary and diagnostic framework modules

Advantech Server iManager RESTful API Programming Guide Page 10

SERVER IMANAGER RESTFUL API

21 URL Structure

Access to resources is provided via URL paths Client applications should send requests over the HTTP protocol using standard GET POST PUT and DELETE methods

Server iManager URL structure

[protocol][host][port]api[resource name]

where

[protocol] = the communication protocol (HTTP)

[host] = the host machine IP address where Server iManager service is running

[port] = the port number on which Server iManager service is listening

[resource name] = the name of the resource to be returned

For information on the host and port please refer to Server iManager user manual

22 Authentication amp login API

For remote access you need to login to get an authentication token which is required for each remote access request The login API provides JWT token-based authentication for the RESTful API

Syntax

HTTP Method POST

URI apilogin

Parameters

Parameter Content Type ApplicationJSON

Name Description

body Required

username admin

password advantech

Table 1 Descriptions for login API parameters

Advantech Server iManager RESTful API Programming Guide Page 11

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

token XVCJ9123eyJle456 3zQ3zRQ789

401 Not authorized

Example value

Error Not Authorized

Table 2 Descriptions of login API response

Example curl command

curl -X POST -d username admin password advantech -H Content-Typeapplicationjson http1721710648087apilogin

23 List API

The List API lists all of the RESTful APIs supported by Server iManager

Syntax

HTTP Method GET

URI api

Parameters

Name Description

NA NA

Table 3 Descriptions for list API parameters

Advantech Server iManager RESTful API Programming Guide Page 12

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

config_url http [host][port]apiconfig

login_url http [host][port]apilogin

Table 4 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087api

Example curl command from local side

curl http1270018087api

24 Config API

Get Config

The Get Config API gets all of the data from the config file It shows the password as in order to maintain security

Syntax

HTTP Method GET

URI apiconfig

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

Advantech Server iManager RESTful API Programming Guide Page 13

collector

interval 20s

mce 1

network 1

pcie 1

sensor 1

storage 1

log

level info

max-days 10

max-size 102400000

path varlogahg

Table 5 Descriptions of get config API response

Example curl command from the remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfig

Example curl command from the local side

curl http1270018087apiconfig

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 6: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 5

Table of Contents

INTRODUCTION 9

SERVER IMANAGER RESTFUL API 10

21 URL STRUCTURE 10

22 AUTHENTICATION amp LOGIN API 10

23 LIST API 11

24 CONFIG API 12

Get Config 12 Update Config 14 Test Config 16

25 COLLECTOR API 17

26 STATUS API 19

27 EVENT API 21

Get Event 21 Clear Event 22

28 SUMMARY API 23

29 RESTART API 24

210 SYSTEM INFORMATION API 24

211 DIAGNOSTIC API 25

List 25 Info 26 Result 27 Log 29 Start 31 Stop 32 Status 33

Advantech Server iManager RESTful API Programming Guide Page 6

List of Tables Table 1 Descriptions for login API parameters 10

Table 2 Descriptions of login API response 11

Table 3 Descriptions for list API parameters 11

Table 4 Descriptions of list API response 12

Table 5 Descriptions of get config API response 13

Table 6 Descriptions for update config API parameters 14

Table 7 Descriptions of update config API response 15

Table 8 Descriptions of test config API response 17

Table 9 Descriptions for collector API parameters 17

Table 10 Descriptions of collector API response 18

Table 11 Descriptions for status API parameters 19

Table 12 Descriptions of status API response 19

Table 13 Descriptions for get event API parameters 21

Table 14 Descriptions of get event API response 22

Table 15 Descriptions of clear event API response 22

Table 16 Descriptions of summary API response 23

Table 17 Descriptions of restart API response 24

Table 18 Descriptions of sysinfo API response 25

Table 19 Descriptions of list API response 26

Table 20 Descriptions for info API parameters 26

Table 21 Descriptions of info API response 27

Table 22 Descriptions for result API parameters 28

Table 23 Descriptions of result API response 28

Table 24 Descriptions for log API parameters 29

Table 25 Descriptions of log API response 29

Table 26 Descriptions for start API parameters 31

Table 27 Descriptions of start API response 32

Table 28 Descriptions for stop API parameters 32

Table 29 Descriptions of stop API response 33

Table 30 Descriptions for status API parameters 33

Table 31 Descriptions of status API response 34

Advantech Server iManager RESTful API Programming Guide Page 7

Advantech Server iManager RESTful API Programming Guide Page 8

Glossary

CLI Command-line interface

HTTP Hypertext Transfer Protocol

REST Representational state transfer

URL Uniform resource locator

Advantech Server iManager RESTful API Programming Guide Page 9

INTRODUCTION

This document describes the REST (Representation State Transfer) interface for Server iManager REST is a set of constraints for architectures that typically communicate over HTTP

Server iManager RESTful APIs provide services for the CLI utility to access the data of collector config summary and diagnostic framework modules

Advantech Server iManager RESTful API Programming Guide Page 10

SERVER IMANAGER RESTFUL API

21 URL Structure

Access to resources is provided via URL paths Client applications should send requests over the HTTP protocol using standard GET POST PUT and DELETE methods

Server iManager URL structure

[protocol][host][port]api[resource name]

where

[protocol] = the communication protocol (HTTP)

[host] = the host machine IP address where Server iManager service is running

[port] = the port number on which Server iManager service is listening

[resource name] = the name of the resource to be returned

For information on the host and port please refer to Server iManager user manual

22 Authentication amp login API

For remote access you need to login to get an authentication token which is required for each remote access request The login API provides JWT token-based authentication for the RESTful API

Syntax

HTTP Method POST

URI apilogin

Parameters

Parameter Content Type ApplicationJSON

Name Description

body Required

username admin

password advantech

Table 1 Descriptions for login API parameters

Advantech Server iManager RESTful API Programming Guide Page 11

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

token XVCJ9123eyJle456 3zQ3zRQ789

401 Not authorized

Example value

Error Not Authorized

Table 2 Descriptions of login API response

Example curl command

curl -X POST -d username admin password advantech -H Content-Typeapplicationjson http1721710648087apilogin

23 List API

The List API lists all of the RESTful APIs supported by Server iManager

Syntax

HTTP Method GET

URI api

Parameters

Name Description

NA NA

Table 3 Descriptions for list API parameters

Advantech Server iManager RESTful API Programming Guide Page 12

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

config_url http [host][port]apiconfig

login_url http [host][port]apilogin

Table 4 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087api

Example curl command from local side

curl http1270018087api

24 Config API

Get Config

The Get Config API gets all of the data from the config file It shows the password as in order to maintain security

Syntax

HTTP Method GET

URI apiconfig

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

Advantech Server iManager RESTful API Programming Guide Page 13

collector

interval 20s

mce 1

network 1

pcie 1

sensor 1

storage 1

log

level info

max-days 10

max-size 102400000

path varlogahg

Table 5 Descriptions of get config API response

Example curl command from the remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfig

Example curl command from the local side

curl http1270018087apiconfig

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 7: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 6

List of Tables Table 1 Descriptions for login API parameters 10

Table 2 Descriptions of login API response 11

Table 3 Descriptions for list API parameters 11

Table 4 Descriptions of list API response 12

Table 5 Descriptions of get config API response 13

Table 6 Descriptions for update config API parameters 14

Table 7 Descriptions of update config API response 15

Table 8 Descriptions of test config API response 17

Table 9 Descriptions for collector API parameters 17

Table 10 Descriptions of collector API response 18

Table 11 Descriptions for status API parameters 19

Table 12 Descriptions of status API response 19

Table 13 Descriptions for get event API parameters 21

Table 14 Descriptions of get event API response 22

Table 15 Descriptions of clear event API response 22

Table 16 Descriptions of summary API response 23

Table 17 Descriptions of restart API response 24

Table 18 Descriptions of sysinfo API response 25

Table 19 Descriptions of list API response 26

Table 20 Descriptions for info API parameters 26

Table 21 Descriptions of info API response 27

Table 22 Descriptions for result API parameters 28

Table 23 Descriptions of result API response 28

Table 24 Descriptions for log API parameters 29

Table 25 Descriptions of log API response 29

Table 26 Descriptions for start API parameters 31

Table 27 Descriptions of start API response 32

Table 28 Descriptions for stop API parameters 32

Table 29 Descriptions of stop API response 33

Table 30 Descriptions for status API parameters 33

Table 31 Descriptions of status API response 34

Advantech Server iManager RESTful API Programming Guide Page 7

Advantech Server iManager RESTful API Programming Guide Page 8

Glossary

CLI Command-line interface

HTTP Hypertext Transfer Protocol

REST Representational state transfer

URL Uniform resource locator

Advantech Server iManager RESTful API Programming Guide Page 9

INTRODUCTION

This document describes the REST (Representation State Transfer) interface for Server iManager REST is a set of constraints for architectures that typically communicate over HTTP

Server iManager RESTful APIs provide services for the CLI utility to access the data of collector config summary and diagnostic framework modules

Advantech Server iManager RESTful API Programming Guide Page 10

SERVER IMANAGER RESTFUL API

21 URL Structure

Access to resources is provided via URL paths Client applications should send requests over the HTTP protocol using standard GET POST PUT and DELETE methods

Server iManager URL structure

[protocol][host][port]api[resource name]

where

[protocol] = the communication protocol (HTTP)

[host] = the host machine IP address where Server iManager service is running

[port] = the port number on which Server iManager service is listening

[resource name] = the name of the resource to be returned

For information on the host and port please refer to Server iManager user manual

22 Authentication amp login API

For remote access you need to login to get an authentication token which is required for each remote access request The login API provides JWT token-based authentication for the RESTful API

Syntax

HTTP Method POST

URI apilogin

Parameters

Parameter Content Type ApplicationJSON

Name Description

body Required

username admin

password advantech

Table 1 Descriptions for login API parameters

Advantech Server iManager RESTful API Programming Guide Page 11

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

token XVCJ9123eyJle456 3zQ3zRQ789

401 Not authorized

Example value

Error Not Authorized

Table 2 Descriptions of login API response

Example curl command

curl -X POST -d username admin password advantech -H Content-Typeapplicationjson http1721710648087apilogin

23 List API

The List API lists all of the RESTful APIs supported by Server iManager

Syntax

HTTP Method GET

URI api

Parameters

Name Description

NA NA

Table 3 Descriptions for list API parameters

Advantech Server iManager RESTful API Programming Guide Page 12

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

config_url http [host][port]apiconfig

login_url http [host][port]apilogin

Table 4 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087api

Example curl command from local side

curl http1270018087api

24 Config API

Get Config

The Get Config API gets all of the data from the config file It shows the password as in order to maintain security

Syntax

HTTP Method GET

URI apiconfig

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

Advantech Server iManager RESTful API Programming Guide Page 13

collector

interval 20s

mce 1

network 1

pcie 1

sensor 1

storage 1

log

level info

max-days 10

max-size 102400000

path varlogahg

Table 5 Descriptions of get config API response

Example curl command from the remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfig

Example curl command from the local side

curl http1270018087apiconfig

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 8: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 7

Advantech Server iManager RESTful API Programming Guide Page 8

Glossary

CLI Command-line interface

HTTP Hypertext Transfer Protocol

REST Representational state transfer

URL Uniform resource locator

Advantech Server iManager RESTful API Programming Guide Page 9

INTRODUCTION

This document describes the REST (Representation State Transfer) interface for Server iManager REST is a set of constraints for architectures that typically communicate over HTTP

Server iManager RESTful APIs provide services for the CLI utility to access the data of collector config summary and diagnostic framework modules

Advantech Server iManager RESTful API Programming Guide Page 10

SERVER IMANAGER RESTFUL API

21 URL Structure

Access to resources is provided via URL paths Client applications should send requests over the HTTP protocol using standard GET POST PUT and DELETE methods

Server iManager URL structure

[protocol][host][port]api[resource name]

where

[protocol] = the communication protocol (HTTP)

[host] = the host machine IP address where Server iManager service is running

[port] = the port number on which Server iManager service is listening

[resource name] = the name of the resource to be returned

For information on the host and port please refer to Server iManager user manual

22 Authentication amp login API

For remote access you need to login to get an authentication token which is required for each remote access request The login API provides JWT token-based authentication for the RESTful API

Syntax

HTTP Method POST

URI apilogin

Parameters

Parameter Content Type ApplicationJSON

Name Description

body Required

username admin

password advantech

Table 1 Descriptions for login API parameters

Advantech Server iManager RESTful API Programming Guide Page 11

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

token XVCJ9123eyJle456 3zQ3zRQ789

401 Not authorized

Example value

Error Not Authorized

Table 2 Descriptions of login API response

Example curl command

curl -X POST -d username admin password advantech -H Content-Typeapplicationjson http1721710648087apilogin

23 List API

The List API lists all of the RESTful APIs supported by Server iManager

Syntax

HTTP Method GET

URI api

Parameters

Name Description

NA NA

Table 3 Descriptions for list API parameters

Advantech Server iManager RESTful API Programming Guide Page 12

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

config_url http [host][port]apiconfig

login_url http [host][port]apilogin

Table 4 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087api

Example curl command from local side

curl http1270018087api

24 Config API

Get Config

The Get Config API gets all of the data from the config file It shows the password as in order to maintain security

Syntax

HTTP Method GET

URI apiconfig

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

Advantech Server iManager RESTful API Programming Guide Page 13

collector

interval 20s

mce 1

network 1

pcie 1

sensor 1

storage 1

log

level info

max-days 10

max-size 102400000

path varlogahg

Table 5 Descriptions of get config API response

Example curl command from the remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfig

Example curl command from the local side

curl http1270018087apiconfig

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 9: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 8

Glossary

CLI Command-line interface

HTTP Hypertext Transfer Protocol

REST Representational state transfer

URL Uniform resource locator

Advantech Server iManager RESTful API Programming Guide Page 9

INTRODUCTION

This document describes the REST (Representation State Transfer) interface for Server iManager REST is a set of constraints for architectures that typically communicate over HTTP

Server iManager RESTful APIs provide services for the CLI utility to access the data of collector config summary and diagnostic framework modules

Advantech Server iManager RESTful API Programming Guide Page 10

SERVER IMANAGER RESTFUL API

21 URL Structure

Access to resources is provided via URL paths Client applications should send requests over the HTTP protocol using standard GET POST PUT and DELETE methods

Server iManager URL structure

[protocol][host][port]api[resource name]

where

[protocol] = the communication protocol (HTTP)

[host] = the host machine IP address where Server iManager service is running

[port] = the port number on which Server iManager service is listening

[resource name] = the name of the resource to be returned

For information on the host and port please refer to Server iManager user manual

22 Authentication amp login API

For remote access you need to login to get an authentication token which is required for each remote access request The login API provides JWT token-based authentication for the RESTful API

Syntax

HTTP Method POST

URI apilogin

Parameters

Parameter Content Type ApplicationJSON

Name Description

body Required

username admin

password advantech

Table 1 Descriptions for login API parameters

Advantech Server iManager RESTful API Programming Guide Page 11

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

token XVCJ9123eyJle456 3zQ3zRQ789

401 Not authorized

Example value

Error Not Authorized

Table 2 Descriptions of login API response

Example curl command

curl -X POST -d username admin password advantech -H Content-Typeapplicationjson http1721710648087apilogin

23 List API

The List API lists all of the RESTful APIs supported by Server iManager

Syntax

HTTP Method GET

URI api

Parameters

Name Description

NA NA

Table 3 Descriptions for list API parameters

Advantech Server iManager RESTful API Programming Guide Page 12

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

config_url http [host][port]apiconfig

login_url http [host][port]apilogin

Table 4 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087api

Example curl command from local side

curl http1270018087api

24 Config API

Get Config

The Get Config API gets all of the data from the config file It shows the password as in order to maintain security

Syntax

HTTP Method GET

URI apiconfig

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

Advantech Server iManager RESTful API Programming Guide Page 13

collector

interval 20s

mce 1

network 1

pcie 1

sensor 1

storage 1

log

level info

max-days 10

max-size 102400000

path varlogahg

Table 5 Descriptions of get config API response

Example curl command from the remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfig

Example curl command from the local side

curl http1270018087apiconfig

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 10: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 9

INTRODUCTION

This document describes the REST (Representation State Transfer) interface for Server iManager REST is a set of constraints for architectures that typically communicate over HTTP

Server iManager RESTful APIs provide services for the CLI utility to access the data of collector config summary and diagnostic framework modules

Advantech Server iManager RESTful API Programming Guide Page 10

SERVER IMANAGER RESTFUL API

21 URL Structure

Access to resources is provided via URL paths Client applications should send requests over the HTTP protocol using standard GET POST PUT and DELETE methods

Server iManager URL structure

[protocol][host][port]api[resource name]

where

[protocol] = the communication protocol (HTTP)

[host] = the host machine IP address where Server iManager service is running

[port] = the port number on which Server iManager service is listening

[resource name] = the name of the resource to be returned

For information on the host and port please refer to Server iManager user manual

22 Authentication amp login API

For remote access you need to login to get an authentication token which is required for each remote access request The login API provides JWT token-based authentication for the RESTful API

Syntax

HTTP Method POST

URI apilogin

Parameters

Parameter Content Type ApplicationJSON

Name Description

body Required

username admin

password advantech

Table 1 Descriptions for login API parameters

Advantech Server iManager RESTful API Programming Guide Page 11

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

token XVCJ9123eyJle456 3zQ3zRQ789

401 Not authorized

Example value

Error Not Authorized

Table 2 Descriptions of login API response

Example curl command

curl -X POST -d username admin password advantech -H Content-Typeapplicationjson http1721710648087apilogin

23 List API

The List API lists all of the RESTful APIs supported by Server iManager

Syntax

HTTP Method GET

URI api

Parameters

Name Description

NA NA

Table 3 Descriptions for list API parameters

Advantech Server iManager RESTful API Programming Guide Page 12

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

config_url http [host][port]apiconfig

login_url http [host][port]apilogin

Table 4 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087api

Example curl command from local side

curl http1270018087api

24 Config API

Get Config

The Get Config API gets all of the data from the config file It shows the password as in order to maintain security

Syntax

HTTP Method GET

URI apiconfig

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

Advantech Server iManager RESTful API Programming Guide Page 13

collector

interval 20s

mce 1

network 1

pcie 1

sensor 1

storage 1

log

level info

max-days 10

max-size 102400000

path varlogahg

Table 5 Descriptions of get config API response

Example curl command from the remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfig

Example curl command from the local side

curl http1270018087apiconfig

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 11: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 10

SERVER IMANAGER RESTFUL API

21 URL Structure

Access to resources is provided via URL paths Client applications should send requests over the HTTP protocol using standard GET POST PUT and DELETE methods

Server iManager URL structure

[protocol][host][port]api[resource name]

where

[protocol] = the communication protocol (HTTP)

[host] = the host machine IP address where Server iManager service is running

[port] = the port number on which Server iManager service is listening

[resource name] = the name of the resource to be returned

For information on the host and port please refer to Server iManager user manual

22 Authentication amp login API

For remote access you need to login to get an authentication token which is required for each remote access request The login API provides JWT token-based authentication for the RESTful API

Syntax

HTTP Method POST

URI apilogin

Parameters

Parameter Content Type ApplicationJSON

Name Description

body Required

username admin

password advantech

Table 1 Descriptions for login API parameters

Advantech Server iManager RESTful API Programming Guide Page 11

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

token XVCJ9123eyJle456 3zQ3zRQ789

401 Not authorized

Example value

Error Not Authorized

Table 2 Descriptions of login API response

Example curl command

curl -X POST -d username admin password advantech -H Content-Typeapplicationjson http1721710648087apilogin

23 List API

The List API lists all of the RESTful APIs supported by Server iManager

Syntax

HTTP Method GET

URI api

Parameters

Name Description

NA NA

Table 3 Descriptions for list API parameters

Advantech Server iManager RESTful API Programming Guide Page 12

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

config_url http [host][port]apiconfig

login_url http [host][port]apilogin

Table 4 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087api

Example curl command from local side

curl http1270018087api

24 Config API

Get Config

The Get Config API gets all of the data from the config file It shows the password as in order to maintain security

Syntax

HTTP Method GET

URI apiconfig

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

Advantech Server iManager RESTful API Programming Guide Page 13

collector

interval 20s

mce 1

network 1

pcie 1

sensor 1

storage 1

log

level info

max-days 10

max-size 102400000

path varlogahg

Table 5 Descriptions of get config API response

Example curl command from the remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfig

Example curl command from the local side

curl http1270018087apiconfig

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 12: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 11

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

token XVCJ9123eyJle456 3zQ3zRQ789

401 Not authorized

Example value

Error Not Authorized

Table 2 Descriptions of login API response

Example curl command

curl -X POST -d username admin password advantech -H Content-Typeapplicationjson http1721710648087apilogin

23 List API

The List API lists all of the RESTful APIs supported by Server iManager

Syntax

HTTP Method GET

URI api

Parameters

Name Description

NA NA

Table 3 Descriptions for list API parameters

Advantech Server iManager RESTful API Programming Guide Page 12

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

config_url http [host][port]apiconfig

login_url http [host][port]apilogin

Table 4 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087api

Example curl command from local side

curl http1270018087api

24 Config API

Get Config

The Get Config API gets all of the data from the config file It shows the password as in order to maintain security

Syntax

HTTP Method GET

URI apiconfig

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

Advantech Server iManager RESTful API Programming Guide Page 13

collector

interval 20s

mce 1

network 1

pcie 1

sensor 1

storage 1

log

level info

max-days 10

max-size 102400000

path varlogahg

Table 5 Descriptions of get config API response

Example curl command from the remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfig

Example curl command from the local side

curl http1270018087apiconfig

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 13: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 12

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

config_url http [host][port]apiconfig

login_url http [host][port]apilogin

Table 4 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087api

Example curl command from local side

curl http1270018087api

24 Config API

Get Config

The Get Config API gets all of the data from the config file It shows the password as in order to maintain security

Syntax

HTTP Method GET

URI apiconfig

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

Advantech Server iManager RESTful API Programming Guide Page 13

collector

interval 20s

mce 1

network 1

pcie 1

sensor 1

storage 1

log

level info

max-days 10

max-size 102400000

path varlogahg

Table 5 Descriptions of get config API response

Example curl command from the remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfig

Example curl command from the local side

curl http1270018087apiconfig

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 14: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 13

collector

interval 20s

mce 1

network 1

pcie 1

sensor 1

storage 1

log

level info

max-days 10

max-size 102400000

path varlogahg

Table 5 Descriptions of get config API response

Example curl command from the remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfig

Example curl command from the local side

curl http1270018087apiconfig

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 15: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 14

Update Config

The Update Config API updates the data in the config file

[protocol][host][port]apiconfig[section name]

where

[section name] = the section name in the config file

Update config API requires that the key name be given with the ldquokeyrdquo keyword and that the new value be given with the ldquovaluerdquo keyword If the password in the REST section has been changed the current password will need to be given with the ldquodatardquo keyword in order to reconfirm the userrsquos identity

Syntax

HTTP Method PUT

URI apiconfig[section name]

Parameters

Name Description

section name Required The section name in the config file

body Required

key user

value admin

Table 6 Descriptions for update config API parameters

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 16: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 15

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

304 Not Modified

Example value

Error PutConfigByID Set config failed

400 Bad Request

Example value

Error PutConfigByID DecodeJsonPayload failed

401 Unauthorized

Example value

Error PutConfigByID Wrong password

Table 7 Descriptions of update config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d data advantech key password value 123456 http1721710648087apiconfigrest

curl -X PUT -H Content-Type applicationjson -H AuthorizationBearer TOKEN -d key user value admin http1721710648087apiconfigrest

Example curl command from local side

curl -X PUT -H Content-Type applicationjson -d data advantech key password value 123456 http1270018087apiconfigrest

curl -X PUT -H Content-Type applicationjson -d key user value admin Error Hyperlink reference not valid

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 17: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 16

Test Config

Test Config API tests the data in the config file

Syntax

HTTP Method GET

URI apiconfigtest

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

name snmp-trap

result pass

message NA

name smtp

result fail

message Invalid SMTP server

name led

result skip

message NA

name lcd

result skip

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 18: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 17

message NA

]

Table 8 Descriptions of test config API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiconfigtest

Example curl command from local side

curl http1270018087apiconfigtest

25 Collector API

The Collector API gets collector data

[protocol][host][port]apiinfo[collector name]ID

where

[collector name] = the collector name (eg sensor network PCIe storage MCE)

ID = the index

Syntax

HTTP Method GET

URI apiinfo[collector name]ID

Parameters

Name Description

collector name Required The name of the collector

ID Optional The index

Table 9 Descriptions for collector API parameters

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 19: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 18

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

id 1

name VERSION_CHANGE

value 0x0

type discrete

status 0x0080

id 2

name BMC_WATCHDOG

value 0x0

type discrete

status 0x0080

]

404 Not Found

Example value

Error Unsupported item

Table 10 Descriptions of collector API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor

curl -H AuthorizationBearer TOKEN http1721710648087apiinfosensor5

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 20: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 19

curl http1270018087apiinfosensor

curl http1270018087apiinfosensor5

26 Status API

The Status API gets the status of collectors

Syntax

HTTP Method GET

URI apistatuscollector name

Parameters

Name Description

collector name Optional The name of the collector

Table 11 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code Description

200 Successful operation

Example value

[

collector mce

status OK

collector network

status OK

]

Table 12 Descriptions of status API response

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 21: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 20

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apistatus

curl -H AuthorizationBearer TOKEN http1721710648087apistatussensor

Example curl command from local side

curl http1270018087apistatus

curl http1270018087apistatussensor

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 22: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 21

27 Event API

Get Event

Get Event API obtains the specified number of last event history entries from the collectors

[protocol][host][port]apieventlast=number

where

number = the number of last event history entries (default 100 range 1~1000)

Syntax

HTTP Method GET

URI apieventlast=number

Parameters

Name Description

last=number Optional The number of last event history entries

Table 13 Descriptions for get event API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

[

time 2018-10-03T070518117011793Z

name sensor

message FAN5-SPEED status changed from ok to cr

time 2018-10-03T070518120825515Z

name sensor

message FAN4-SPEED status changed from ok to cr

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 23: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 22

]

Table 14 Descriptions of get event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -H AuthorizationBearer TOKEN http1721710648087apievent

curl -H AuthorizationBearer TOKEN http1721710648087apieventlast=5

Example curl command from local side

curl http1270018087apievent

curl http1270018087apieventlast=5

Clear Event

The Clear Event API clears the event history from the collectors

Syntax

HTTP Method DELETE

URI apievent

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 15 Descriptions of clear event API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H AuthorizationBearer TOKEN http1721710648087apievent

Example curl command from local side

curl -X DELETE http1270018087apievent

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 24: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 23

28 Summary API

The Summary API downloads the summary zip file and outputs the summary zip file name

Syntax

HTTP Method POSTGET

URI apisummary

Parameters

Noneltfilenamegt

The procedure is as below

1 Generate summary log file

POST apisummary

2 Get log file name

GET apisummary

3 Download log file

GET apisummaryltfile namegt

Responses

Response Code

Description

200 Successful operation

Example value

summary_ 20181018092324zip

Table 16 Descriptions of summary API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apisummary curl -H AuthorizationBearer TOKEN http1721710648087apisummary curl -O -H AuthorizationBearer TOKEN http1721710648087apisummaryltfilenamegt Example curl command from local side curl -X POST http1270018087apisummary curl http1270018087apisummary curl -O http1270018087apisummaryltfilenamegt

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 25: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 24

29 Restart API

The Restart API restarts the Server iManager daemon

Syntax

HTTP Method POST

URI apirestart

Parameters

None

Responses

Response Code

Description

200 Successful operation

Table 17 Descriptions of restart API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X POST -H AuthorizationBearer TOKEN http1721710648087apirestart

Example curl command from local side

curl -X POST http1270018087api restart

210 System Information API

The sysinfo API gets some information for user

Syntax

HTTP Method GET

URI apisysinfo

Parameters

None

Responses

Response Description

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 26: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 25

Code

200 Successful operation

hostname localhostlocaldomain021

product VMware Virtual Platform

sn VMware-56 4d 93 1f 3e fa c4 8f-c0 fd ee 6e a6 89 bd f4

uuid 1F934D56-FA3E-8FC4-C0FD-EE6EA689BDF4

version None

Table 18 Descriptions of sysinfo API response

211 Diagnostic API

List

The List API lists the information of supported services and functions

Syntax

HTTP Method GET

URI apidiag

Parameters

None

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

service [

ser_id 5

ser_name RTC

ser_des A diag service for rtc

func [

fun_id 0

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 27: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 26

fun_name rtc_sys

fun_des System rtc test function

]

]

Table 19 Descriptions of list API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag

Example curl command from local side

curl -X GET http1270018087apidiag

Info

The Info API gets the information of the test capabilities default parameters and accepted types

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]info

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 20 Descriptions for info API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 28: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 27

Example value

ser_id 1

fun_id 0

name cpu_test

description CPU burn in test function

parameters [

param_name duration

param_des The duration of time to test(s)

param_type pt_uint32

def_value 10

cur_value 10

]

404 Not Found

Example value

Error get info error

Table 21 Descriptions of info API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10info

Example curl command from local side

curl -X GET http1270018087apidiag10info

Result

The Result API gets the result of the last performed test of a particular unit

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 29: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 28

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]result

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 22 Descriptions for result API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

error_name ERR_SUCCESS

error_msg OK

success_cnt 0

fail_cnt 0

test_log varlogmessages

404 Not Found

Example value

Error get result error

Table 23 Descriptions of result API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10result

Example curl command from local side

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 30: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 29

curl -X GET http1270018087apidiag10result

Log

The Log API dumps the log file of a diagnostic function

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]log

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 24 Descriptions for log API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

log Log file has not been generated yetn

404 Not Found

Example value

Error get log error

Table 25 Descriptions of log API response

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 31: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 30

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10log

Example curl command from local side

curl -X GET http1270018087apidiag10log

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 32: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 31

Start

The Start API starts a diagnostic function Service specific parameters can be passed

Syntax

HTTP Method PUT

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

body Optional

parameter1 5

parameter2 10

Table 26 Descriptions for start API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message start function OK

404 Not Found

Example value

Error start function error

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 33: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 32

Table 27 Descriptions of start API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X PUT -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X PUT http1270018087apidiag10

Stop

The Stop API stops a diagnostic function immediately

Syntax

HTTP Method DELETE

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 28 Descriptions for stop API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

fun_id 0

message stop function OK

404 Not Found

Example value

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 34: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 33

Error stop function error

Table 29 Descriptions of stop API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X DELETE -H Authorization Bearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X DELETE http1270018087apidiag10

Status

The Status API gets the status of the service

Syntax

HTTP Method GET

URI apidiag[service ID][function ID]

Parameters

Name Description

service ID Required The ID of service

function ID Required The ID of function

Table 30 Descriptions for status API parameters

Responses

Response Content Type ApplicationJSON

Response Code

Description

200 Successful operation

Example value

ser_id 1

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status
Page 35: RESTFUL API PROGRAMMING GUIDE - Advantech

Advantech Server iManager RESTful API Programming Guide Page 34

fun_id 0

status st_stopped

404 Not Found

Example value

Error get status error

Table 31 Descriptions of status API response

Example curl command from remote side please replace ldquoTOKENrdquo with the token obtained from the login API

curl -X GET -H AuthorizationBearer TOKEN http1721710648087apidiag10

Example curl command from local side

curl -X GET http1270018087apidiag10

  • 1 Introduction
  • 2 Server iManager RESTful API
    • 21 URL Structure
    • 22 Authentication amp login API
    • 23 List API
    • 24 Config API
      • 241 Get Config
      • 242 Update Config
      • 243 Test Config
        • 25 Collector API
        • 26 Status API
        • 27 Event API
          • 271 Get Event
          • 272 Clear Event
            • 28 Summary API
            • 29 Restart API
            • 210 System Information API
            • 211 Diagnostic API
              • 2111 List
              • 2112 Info
              • 2113 Result
              • 2114 Log
              • 2115 Start
              • 2116 Stop
              • 2117 Status