Call API

This function allows you to easily call any API. The format is

slcli call-api SoftLayer_Service method param1 param2 –id=1234 –mask=”mask[id,name]”

Parameters should be in the order they are presented on sldn.softlayer.com. Any complex parameters (those that link to other datatypes) should be presented as JSON strings. They need to be enclosed in single quotes (), and variables and strings enclosed in double quotes ().

For example: {“hostname”:”test”,ssh_keys:[{“id”:1234}]}

call-api

Call arbitrary API endpoints with the given SERVICE and METHOD.

For parameters that require a datatype, use a JSON string for that parameter. Example:

slcli call-api Account getObject
slcli call-api Account getVirtualGuests --limit=10 --mask=id,hostname
slcli call-api Virtual_Guest getObject --id=12345
slcli call-api Metric_Tracking_Object getBandwidthData --id=1234 \
    "2015-01-01 00:00:00" "2015-01-1 12:00:00" public
slcli call-api Account getVirtualGuests \
    -f 'virtualGuests.datacenter.name=dal05' \
    -f 'virtualGuests.maxCpu=4' \
    --mask=id,hostname,datacenter.name,maxCpu
slcli call-api Account getVirtualGuests \
    -f 'virtualGuests.datacenter.name IN dal05,sng01'
slcli call-api Account getVirtualGuests \
    --json-filter  '{"virtualGuests":{"hostname":{"operation":"^= test"}}}' --limit=10
slcli -v call-api SoftLayer_User_Customer addBulkPortalPermission --id=1234567 \
    '[{"keyName": "NETWORK_MESSAGE_DELIVERY_MANAGE"}]'
call-api [OPTIONS] SERVICE METHOD [PARAMETERS]...

Options

--id <_id>

Init parameter

-f, --filter <_filters>

Object filters. This should be of the form: ‘property=value’ or ‘nested.property=value’.Complex filters should use –json-filter. (multiple occurrence permitted)

--mask <mask>

String-based object mask

--limit <limit>

Result limit

--offset <offset>

Result offset

--output-python, --no-output-python

Show python example code instead of executing the call

--json-filter <json_filter>

A JSON string to be passed in as the object filter to the API call. Remember to use double quotes (”) for variable names. Can NOT be used with –filter. Dont use whitespace outside of strings, or the slcli might have trouble parsing it.

Arguments

SERVICE

Required argument

METHOD

Required argument

PARAMETERS

Optional argument(s)

Shell

MetaData

Used to retrieve information about the server making the API call. Can be called with an un-authenticated API call.

metadata

Find details about the machine making these API calls.

Choices
backend_ip
backend_mac
datacenter
datacenter_id
fqdn
frontend_mac
id
ip
network
provision_state
tags
user_data
metadata [OPTIONS] [backend_ip|backend_mac|datacenter|datacenter_id|fqdn|front
         end_mac|id|ip|network|provision_state|tags|user_data]

Arguments

PROP

Required argument

These commands only work on devices on the backend SoftLayer network. This allows for self-discovery for newly provisioned resources.