def query(method='servers', server_id=None, command=None, args=None,
          http_method='GET', root='api_root'):
    ''' Make a call to the Scaleway API.
    '''

    if root == 'api_root':
        default_url = 'https://cp-par1.scaleway.com'
    else:
        default_url = 'https://api-marketplace.scaleway.com'

    base_path = six.text_type(config.get_cloud_config_value(
        root,
        get_configured_provider(),
        __opts__,
        search_global=False,
        default=default_url
    ))

    path = '{0}/{1}/'.format(base_path, method)

    if server_id:
        path += '{0}/'.format(server_id)

    if command:
        path += command

    if not isinstance(args, dict):
        args = {}

    token = config.get_cloud_config_value(
        'token', get_configured_provider(), __opts__, search_global=False
    )

    data = salt.utils.json.dumps(args)

    request = __utils__["http.query"](path,
                                      method=http_method,
                                      data=data,
                                      status=True,
                                      decode=True,
                                      decode_type='json',
                                      data_render=True,
                                      data_renderer='json',
                                      headers=True,
                                      header_dict={'X-Auth-Token': token,
                                                   'User-Agent': "salt-cloud",
                                                   'Content-Type': 'application/json'})
    if request['status'] > 299:
        raise SaltCloudSystemExit(
            'An error occurred while querying Scaleway. HTTP Code: {0}  '
            'Error: \'{1}\''.format(
                request['status'],
                request['error']
            )
        )

    # success without data
    if request['status'] == 204:
        return True

    return salt.utils.json.loads(request['body'])
Make a call to the Scaleway API.