Search code examples
ibm-cloud-infrastructure

Trying to use SoftLayer_Network_Service_VPN_Overrides with the createObjects method and the REST API


I am trying to use SoftLayer_Network_Service_VPN_Overrides with the createObjects method and the REST API to add VPN overrides. My account is set to manual for VPN access. I am trying something like this:

curl -X POST -d @subnetadd.json https://$SL_API_USER:$SL_API_KEY@api.softlayer.com/rest/v3/SoftLayer_Network_Service_Vpn_Overrides/createObjects.xml

where subnetadd.json looks something like this:

{
    "parameters" : [
        {
            "subnetId" : 123456,
            "userId" : 123456
        }
    ]
}

When I have valid entries in there I get a false in the xml that is returned. Do I need to frame my parameters differently or the number of parameters?


Solution

  • The SoftLayer_Network_Service_Vpn_Overrides::createObjects method receives an array of SoftLayer_Network_Service_Vpn_Overrides objects, try the following modification:

    curl -X POST -d @subnetadd.json https://$SL_API_USER:$SL_API_KEY@api.softlayer.com/rest/v3/SoftLayer_Network_Ser‌​vice_Vpn_Overrides/createObjects.json
    
    {  
       "parameters":[  
          [  
             {  
                "subnetId":123456,
                "userId":123456
             }
          ]
       ]
    }
    

    Note: If you are using .json in the payload, the return type should be the same.