0
votes

I'm trying to get a bandwidth image from the SoftLayer API, using CURL.

I'm using this method:

http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getBandwidthImage

I've built the URL to curl:

https://USER:[email protected]/rest/v3/SoftLayer_Virtual_Guest/GUESTID/getBandwidthImage.json?parameters=[{"networkType":"public","snapshotRange":"current_billing_cycle","dateSpecified","04/01/2017","dateSpecifiedEnd","04/17/2017"}]

Filling in the parameters mentioned. But this fails with a 500 internal server error and I get the following returned:

{ "error": "Invalid value provided for 'Invalid value of '' for $dateRange parameter.'.", "code": "SoftLayer_Exception_InvalidValue" }

The documentation doesn't talk about dateRange at all, I've tried supplying a dateRange such as:

"dateRange","04/01/2017-04/17/2017"

But that doesn't help, I still get the same error.

Any suggestions for how I make this work?

1

1 Answers

0
votes

your curl requests look bad, you need to specify that your are gonna use the POST method see:https://gist.github.com/leonidlm/e3804a095b88e2348067

the request url should be something like this: curl -X POST --data @/tmp/post https://<user>:<api_key>@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/createObject

and in the @/tmp/post file contains the payload for the request:

parameters=[{"networkType":"public","snapshotRange":"current_billing_cycle","dateSpecified","04/01/2017","dateSpecifiedEnd","04/17/2017"}]

regards