IBM Support

events:cloudCount fails with error when using timeframe option

Troubleshooting


Problem

The following error is reported:
 
$ ./apic-10.0.5.4 -m analytics events:cloudCount --server cloud.mgmt.dev.apictenlts.ibmlab.test --analytics-service analytics --format json --timeframe yesterday
JSON: json: cannot unmarshal string into Go struct field .errors of type models.ErrorPropErrorsItems

Cause

The yesterday value for timeframe is incorrect. 

Diagnosing The Problem

Using the --debug flag:
$ ./apic-10.0.5.4 -m analytics events:cloudCount --server cloud.mgmt.dev.apictenlts.ibmlab.test --analytics-service analytics --format json --timeframe 1 --debug 

.... 

{"status":400,"message":["Error validating the parameter timeframe against definition '[object Object]'"],"errors":["(Body) must be equal to one of the allowed values (allowed values: last15minutes,last30minutes,last1hour,last4hours,last12hours,last24hours,last7days,last30days) (line: 0, column: 0)"]} Error: error unmarshaling JSON: json: cannot unmarshal string into Go struct field .errors of type models.ErrorPropErrorsItems

Resolving The Problem

The allowed values are: last15minutes,last30minutes,last1hour,last4hours,last12hours,last24hours,last7days,last30days

$ ./apic-10.0.5.4 -m analytics events:cloudCount --server cloud.mgmt.dev.apictenlts.ibmlab.test --analytics-service analytics --format json --timeframe last30days
{
    "total": 2
}

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB45","label":"Automation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSMNED","label":"IBM API Connect"},"ARM Category":[{"code":"a8m50000000CeBlAAK","label":"API Connect-\u003EManagement and Monitoring (MM)-\u003EAnalytics"}],"ARM Case Number":"TS014317231","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"10.0.5"}]

Document Information

Modified date:
03 October 2023

UID

ibm17046053