1

I am trying to get Metric data of my resources in a specific period.

First, I have tried with SoftLayer_Virtual_Guest/$id/getCpuMetricDataByDate for one of my vm instance.

curl --user "$id:$password" -sk https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/$id/getCpuMetricDataByDate -d '{"startDateTime":"07/25/2017 16:00:00", "endDateTime":"07/25/2017 17:00:00"}'

The problem i am facing is, this request ignores the datetime filter i specified and passed with the request body, It returns me all the metric history from the birth of the vm.

  1. Is it a bug or did i do something wrong?
  2. The form of dateTime, one of the return value is like 2017-07-05T10:00:00+09:00, and i realised the timezone is relying on what i have selected for my user in the Customer Portal. Is there any way to specify timezone when request a API so that i am available to get data on my preference timezone. (For example, when i request Metric data of a vm with timezone = JST, it returns me as GMT+09, if i request Metric data of another vm with timezone = CTT, it returns me as GMT+08)
iehrlich
  • 3,572
  • 4
  • 34
  • 43
Daul
  • 11
  • 1

1 Answers1

0

I recomend you read this articles:

https://sldn.softlayer.com/article/rest

https://sldn.softlayer.com/blog/bpotter/more-softlayer-rest-api-examples

https://sldn.softlayer.com/node/274103

https://sldn.softlayer.com/blog/klaude/Time-REST-Everyone

your body is wrong it should be:

{
  "parameters": [ 
    "07/25/2017 16:00:00", "07/25/2017 17:00:00"
   ]
}

for you second answer the API works with the timezone of your profile (the one in the control portal) If you want a different time zome you need to change the timezone in your profile.