VRA 6.2 REST API: resource Action with object mapped by VRO

I created a resource Action (Advanced Services - resources Actions) who calls a workflow orchestrator (VRO) to do a few things.  The VRO workflow takes three objects as inputs: 2 channel and a VC:VirtualMachine.  Connecting the web GUI, when a user selects the action for the specific virtual machine, they are presented with a form asking to specify the content of the 2 strings.  The VC:VirtualMachine object is transparant and (I think) is automatically mapped internally to the enabled virtual machine.  This works very well at the launch through the web GUI.  Now, I need to create the same scenario using the REST API.  I created the "ResourceActionRequest" object JSON and included the 2 strings as indicated in the request data, but I have no idea how to do to add the VC:VirtualMachine object to the request.  I thought maybe it was too transparent, but I get an error if I try to send the JSON without the 3rd data item.  For example, here is my "ResourceActionRequest" object JSON:

{

"@type": "ResourceActionRequest",

'resourceRef': {}

'id': '< resourceRef-id >.

},

'resourceActionRef': {}

'id': '< resourceActionRef-id >.

},

'Organization': {}

"tenantRef': '< label >."

"tenantLabel': '< label >."

'subtenantRef': '< subtenantRef > ',.

'subtenantLabel': '< subtenantLabel > '.

},

"State": "SUBJECT."

"requestNumber": 0.

'requestData': {}

"items": [{}

"key": "provider-MyFirstCustomProperty."

'value': {}

"type": "string",.

"value': ' blah, blah, blah."

}

},

{

"key": "provider-MySecondCustomProperty."

'value': {}

"type": "string",.

"value': ' blah, blah, blah."

}

}]

}

}

I don't know how to provide the VC:VirtualMachine in the application.  Any help would be appreciated.  Thank you!

-Stephen

Hey Stephen,

I do not see the bits that I expect:

{

"key": "provider-MachineName."

'value': {}

"type": "string",.

'value': 'vra045 '.

}

}

It's vRA identity Machine which must correspond to the rear.

Grant

Tags: VMware

Similar Questions

  • Query of REST API resources

    I'm trying to get a resource by name using the/api/resources URI. He has a list of parameters that can be used to perform a more detailed query. I tried just about everything I can think of to get the query to work but nothing is. Does anyone have a work resource query?

    nameArray of names of resources to interview. NOTE: Currently, only single element taken in chargequeryXS: StringNoneYes
    var body = {"name" : "vmName"}
    System.log(JSON.stringify(body));
    var request = restHost.createRequest("GET", "/resources", JSON.stringify(body));
    request.contentType = "application/json";
    
    var json = JSON.stringify(System.getModule("com.vmware.library.http-rest").xml2json(request.execute().contentAsString));
    System.log(json);
    

    I tried all these without success:

    var body = {"name" : "vmName"}
    var body = {"name" :["vmName"]}
    var body = [{"name" : "vmName"}]
    var body = {"value" : {"name" : "vmName"}
    var body = {"value": {"name" : ["vmName"]}
    var body = {"value" : [{"name" : "vmName"}]
    

    variations of the above, but with different top level like, value (s) key (s), resource, property/properties, etc., of property names.

    He hit me after the validation:

    var request = restHost.createRequest("GET", "/resources?name=vmName", null);
    request.contentType = "application/json";
    
    var json = JSON.stringify(System.getModule("com.vmware.library.http-rest").xml2json(request.execute().contentAsString));
    System.log(json);
    

    Which returns my only object.

  • VRA 6.2 REST API: CatalogItemRequest - number of machines?

    I started looking in the REST API vRA for 6.2 and can't seem to properly configure a machine using the CatalogRequestItem type.  However, I can only ask a machine at a time.  Is there a setting (or the value of the property) that can be added to the query to specify the number of machines to ask?  Or is there a different API call to do this?  Thank you.

    Take a loot at the next post. Add this to your JSON blob (where the value is the number of instances that you want to deploy).

      {
        "key": "supplier - Cafe.Shim.VirtualMachine.NumberOfInstances."
        'value': {}
          "type': 'integer."
          'value': 2
        }
      }

    Grant

  • REST api call for the properties of the object in the html bridge provides resource not found (404) error.

    Hello

    I added a bridge Html summary view to our existing plugin (which is in Flex). The html page is displayed in the Summary tab with static data like images and titles. But the .gestJSON of the REST api call fails with the error ' could not load resources: the server responded with a 404 (Not Found) status.

    I followed the bridge Html sample chassisB (chassis - summary.js and html) to create the new page.

    Web.XML of the user interface of the plugin is configured to map/rest / *. bean dataAccessController is defined in the bundle context.

    Java package has the DataAccessController same class as the DataAccessController chassisB class

    This is the URL that I see in the javascript debugger and call API is a failure for this url.  There is no error in the virgo.log.

    https:// /vsphere-client/webui_ui_ns/rest/data/properties/323de5b9-4D2E-4dd7-ae32-98277dd44e90%252Fmf8k-h38?properties=name,model,version < vcenter ip >

    webui_ui_ns-client/vSphere is the value of Web-ContextPath in the plugin MANIFESTO. MF

    I spent a lot of time to understand the issue, but no luck. What I'm doing wrong here? Any help is appreciated.

    version of vCenter server appliance 6.0.0

    SDK - vSphere SDK Web 5.5.0

    1.7.0_79 64-bit JDK

    Thank you

    Deepa

    It was a configuration problem. I missed the tag in the bundle context of spring.

    After you add the 2 lines, it worked.

    Thanks for your time.

  • REST API assignRolePermissionToUserGroup

    Im trying to update the objects of our clients have right of in vROps, programmatically through the REST API. The idea is that when a customer starts rotating or destroyed a virtual computer through vRA, we would find all of their machines virtual provisioned and rebuild the list of objects for their group of vROps through vRO using the REST API of vROps. I have a vRO workflow that looks like this:

    var groupId = "8c380090-d5c3-42a7-a77c-5de4437ce85b"
    var resourceId = "8e62002f-0965-47e2-a82a-6d403b44b756"
    
    var body = {"traversal-spec-instances" : [{
      "traversal-spec-instance" : {
           "selectAllResources" : false,
           "name" : "vSphere Hosts and Clusters",
           "resourceKind" : "vSphere World",
           "adapterKind" : "VMWARE",
           "resourceSelection" : [{
                "resourceId" : [
                     resourceId,
                     "4abb32e5-1fd0-443b-85ed-4995da4a1a0d"
                ],
                "type" : "SPECIFIC"
           }]
      }
    }],
    "allowAllObjects" : false,
    "roleName" : "ReadOnly"
    }
    System.log(JSON.stringify(body));
    
    
    var request = restHost.createRequest("PUT", "/auth/usergroups/" + groupId + "/permissions", body);
    request.contentType = "application/json";
    
    
    var json = JSON.stringify(System.getModule("com.vmware.library.http-rest").xml2json(request.execute().contentAsString));
    System.log(json);
    
    
    

    Which produces the string JSON:

    {"traversal-spec-instances":[{"traversal-spec-instance":{"selectAllResources":false,"name":"vSphere Hosts and Clusters","resourceKind":"vSphere World","adapterKind":"VMWARE","resourceSelection":[{"resourceId":["8e62002f-0965-47e2-a82a-6d403b44b756","4abb32e5-1fd0-443b-85ed-4995da4a1a0d"],"type":"SPECIFIC"}]}}],"allowAllObjects":false,"roleName":"ReadOnly"}
    
    
    

    There are no examples of the request body then I'm just doing what I interpret requires that the documentation of the REST API.

    Run this generates the error:

    {"error":{"message":"Invalid input format.","xmlns:ops":"http://webservice.vmware.com/vRealizeOpsMgr/1.0/","moreInformation":{"info":{"content":"/suite-api/api/auth/usergroups/8c380090-d5c3-42a7-a77c-5de4437ce85b/permissions","name":"api-uri"}},"httpStatusCode":400,"xmlns:xs":"http://www.w3.org/2001/XMLSchema","xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","apiErrorCode":400}}
    
    
    

    Which is not very useful.

    I checked with other API calls that the groupId is correct and returns a grump object valid through the REST API. So my assumption at this point is that the body of the request is malformed but I'm not sure how and errors are not giving me much to go.

    You're right about the resourceKind.  I did some tests and the JSON body below worked for me.  I changed two things:

    1. I converted the body to a string variable.  It seemed that it was sent as an object.
    2. I removed the "path-spec-instance", while the instance is just placed between braces inside the "crossing-spec-proceedings".  I did a get on a sample group and that's how it was formatted.
    var body = {"traversal-spec-instances" : [{  
    
           "selectAllResources" : false,
           "name" : "vSphere Hosts and Clusters",
           "resourceKind" : "vSphere World",
           "adapterKind" : "VMWARE",
           "resourceSelection" : [{
                "resourceId" : [
                     resourceId,
                     "414f5fdc-a651-4886-adb7-5d947c69ae63"
                ],
                "type" : "SPECIFIC"
           }]  
    
    }],
    "allowAllObjects" : false,
    "roleName" : "ReadOnly"
    }
    System.log(JSON.stringify(body));
    System.log(typeof body);
    var stringBody = JSON.stringify(body);  
    
    var request = restHost.createRequest("PUT", "/auth/usergroups/" + groupId + "/permissions", stringBody);
    request.contentType = "application/json";
    
  • REST API - the internal names of the fields in the custom object

    Hello

    We have an old system that uses the SOAP API and I'm rewritten with the REST API. Before, with SOAP, you identify the fields object personalized with their internal names. Therefore, our system and stored that names in its database. Now, I'm facing a problem. as the REST API does not provide the internal names for the fields in the custom object, as their full names and IDs. Am I wrong? Is it possible to get the internal names through REST? I found, you can get this internal names through the API as a WHOLE, but is there really no way to get them using REST? It seems strange to me and I don't want to use in BULK as there limits for requests per day.

    Hi Marc,

    In bulk API endpoints are the best way to retrieve the details field you are looking for.  Calls to retrieve this detail do not count against the daily API limits for the bulk API.

  • Perspective and visitors to the information using the REST API

    According to this post (Eloqua graphics API), visitors and prospects information is not available with the Eloqua REST API.

    With the Eloqua REST API there is a field that indicates whether a contact is a prospect or visitor?

    Hi Raghu,

    There is a new endpoint API (available with the Summer of Eloqua version), which allows you to retrieve a visitor profile.

    Please find some information on its use here: Eloqua API REST - recovery of visitor profiles

    T.J.

  • There the rest APIs to retrieve the metadata for entity for eloqua objects?

    There is a list of all the objects that are accessible by the REST for CRUD in this link: REST API - Documentation for kernel objects in the objects of the core section.

    For each of the objects listed in the objects of the core section are there is a metadata field in the Properties section.

    For example, for the purpose of the e-mail message, The REST API - to access Emails , under the Properties section, there entered corresponding to the fields of the object of the emails under the
    Name, Type, Description and validation topics.

    Is there a REST API to retrieve the same information, i.e. metadata field for an object programmatically eloqua?
    Otherwise, this is a serious obstacle to building systems that are the metadata engine and support for SOAP is removed...

    The closest to what you are looking for would be endpoints of assistance for a description of the fields. Example of /api/bulk/1.0/contact/fields

    {

    "items": [{}

    'name': "E-mail address",

    "internalName": "C_EmailAddress",

    'dataType': 'emailAddress;

    'hasReadOnlyConstraint': false,

    'hasNotNullConstraint': false,

    'hasUniquenessConstraint': true,

    'Déclaration': '{{Contact.Field (C_EmailAddress)}}.

    "uri": "/ contact/field/100001",

    "converted': ' / Date (-2208970800000) /"

    'updatedAt': ' / Date (-2208970800000) / ".

    },

    {

    'name': "First name",

    "internalName": "C_FirstName",

    'dataType': "string",.

    'hasReadOnlyConstraint': false,

    'hasNotNullConstraint': false,

    'hasUniquenessConstraint': false,

    'Déclaration': '{{Contact.Field (C_FirstName)}}.

    "uri": "/ contact/field/100002."

    "converted': ' / Date (-2208970800000) /"

    "updatedBy": "MgrzzzOracleCloudSupportP01E10",

    'updatedAt': ' / Date (1408993722380) / ".

    },.....

    If so, it will also include an element "defaultValue". How many characters you can store in a field (precision) is documented here: Type of data (data and Digital Formats). The same endpoint exist in bulk 2.0, and there are variants for the account fields and Objetpersonnalise. Another exists in the REST through Api/rest/2.0/assets/contact/fields?depth=complete... It does not include the declaration of ML, but there other useful information such as the type of default update and a flag 'isAccountLinkageField '.

    Similarly, if you describe a form via SOAP or REST, it also will give you the fields and their type.

    Kind regards

    Bojan

  • endpoint vcac rest api

    Rest API is available for the creation of endpoint - vcac? Thank you.

    I don't think you can do this via the REST API directly, but there are workflows in vRO who will do it for you. Orchestrator can be called via REST.

    The workflow looking is called "create a management endpoint.

  • API bulk: creating custom objects, fields, and lists?

    Hi all

    I have searched and passed through the ticket of support for routing, but have not yet managed to find an answer to this question, so I thought that maybe the people who write the API would be the best ones to talk to

    Anyway, in summary, my question is:-

    Is it possible to create lists of contacts, the Contact fields and items customized by using the bulk API 1.0?

    I know, it is possible to create new contacts and add them to an existing list, but I want to create a new list with the bulk API and then add my contacts on this new list.

    Same kind of thing for the Contact fields. I want to be able to check if there is a Contact field and if not create one and then fill in the import.

    Once again, even for custom objects. I know I can do a GET for all currently available Custom objects, but can I create a new using the API as a whole?

    Any help would be most appreciated.

    Thank you

    Hi Chris,

    You cannot create contact fields, shared lists or the custom objects through the bulk API (which in fact is a RESTful API), they must exist already.

    You can use the REST or lists The SOAP API to create only shared the REST API to create the contact fields, but SOAP or REST currently supports the creation of custom data objects.

    If you don't have it already, please take a look here, building on The Eloqua Platform - A Resource Guide and there REST API - Documentation for kernel objects that will hopefully more questions.

    T.J.

  • C#, UCCX, Rest API, PUT (update a resource) and not taken media Type supported

    Hi, I'm developing an application to update the skills of resources with the REST API.

    I can get all the values I want to (GET), but when I try to update a resource using PUT, and then I get a "415 Unsupported Media Type" webException.

    I discovered that c# / UCCX works with demand. MediaType (instead of request. ContentType).

    I got this error when I tried to GET the data. He now works for the GET.

    But to PUT it, I got the error. Method is defined as SAID, MediaType = "application/xml".

    I tried to empty, ' text/xml '...

    Looked on the internet, Web sites, saying always specify ContentType/MediaType = "application/xml", I have already done.

    I also got the same error if I try an application COULD and without sending data.

    Thanks for your help!

    public string MakeRequest()
    {
    var request = (HttpWebRequest) WebRequest.Create (EndPoint);
    request. Credentials = new System.Net.NetworkCredential (login, password);
    request. Method = Method.ToString ();
    request. ContentLength = 0;
    request. Accept = ContentType;
    request. MediaType = ContentType;
                
    #region so PUT
    If (! string.) IsNullOrEmpty (PostData) & method == HttpVerb.PUT)
    {
    encoding of var = new UTF8Encoding();
    PostData = PostData.Replace ("\n", "");
    var bytes = Encoding.UTF8.GetBytes (PostData);
    request. ContentLength = bytes. Length;
                    
    using (var writeStream = request. GetRequestStream())
    {
    writeStream.Write (bytes, 0, bytes.) (Length);
    }
    }
    #endregion

    Try
    {
    assistance (response var = (HttpWebResponse) request. GetResponse())
    {
    var responseValue = string. Empty;

    If (answer. StatusCode! = HttpStatusCode.OK)
    {
    var message = String.Format ("request failed. Received HTTP {0}", response. StatusCode);
    throw new ApplicationException (message);
    }

    Enter the answer
    using (var responseStream = response. GetResponseStream())
    {
    If (responseStream! = null)
    using (var = new StreamReader (responseStream) Player)
    {
    responseValue = reader. ReadToEnd();
    }
    }

    Return responseValue;
    }
    }
    catch (WebException wex)
    {
    error string = wex. Message;
    Return ' ';
    }

    OK you got, in this case, post your request in the Sub forum as well which is sought after by developers and you can you expect a concrete answer/explanation on the same

    https://communities.Cisco.com/community/Developer/Express-configuration-API

    Concerning

    Deepak

  • QUESTION: Can't create a firewall rule to (edge) with the REST API

    Dear Sir

    I am trying to create a firewall rule for simple and basic edge using the REST API.

    I use the REST API guide as a reference on page 158.


    edge-fw-rule.png

    I use the following code (single) in my client REST API (with good content Type (application/xml)):

    < rule >

    < ruleTag > < / ruleTag >

    < name > edge5-rest-rule < / name >

    all < source > < / source >

    < destination > all < / destination >

    < application > all < / application >

    < matchTranslated > true < / matchTranslated >

    < management > in < / direction >

    < action > deny < / action >

    < enabled > false < / enabled >

    < loggingEnabled > true < / loggingEnabled >

    rest-api-rule of the < description > < / description >

    < / rule >

    The error message that I receive is the following:

    <? XML version = "1.0" encoding = "UTF-8"? >

    < error >

    request details invalid <>. Found no match for item rule. < / details >

    < > 223 errorCode < / errorCode >

    < / error >

    The full screenshot of my action REST API is in the screenshot below:

    full-request.png

    Anyone know what I'm doing wrong here?

    Thank you!

    Try this as the body...

    rest-rule

    user

    true

    in

    deny

    fake

    true

    rest-api-rule

  • Create the edge with the NSX REST API

    Hello

    I am trying to create a new benefit using the REST API, but I get the following error over and over again: the server has refused the request because the request entity is in a format not supported by the resource for the requested method.

    I use using a xml model provided by the nsx_61_api.pdf and all the "ids" settings are ok. Can anyone tell my what of wrong in my XML?

    I'm able to get a list of the existing edges using GET on https:// < nsxmgr-ip > /api/4.0/edges/

    In this case, I use the same URL, but with the post OFFICE instead. In the body, I put the following XML code.

    < edge >
    <datacenterMoid>datacenter-2</datacenterMoid>
        < name > MyName-Edge-01 < / name >
        < holding > Default < / holding >
    <vseLogLevelemergency</vseLogLevel> >
    <devices>
    <applianceSize>compact</applianceSize>
            < appliance >
    <resourcePoolId>resgroup-5050</resourcePoolId>
    <datastoreId>datastore-104</datastoreId>
            < / appliance >
        < / appliances >

        < vnics >
            < vnic >
                < index > 0 < / index >
                < name > uplink01 < / name >
                < type > uplink < / type >
    <portgroupId>virtualwire-10</portgroupId>
    <addressGroups>
                    < addressGroup >
    <primaryAddress>10.0.0.1</primaryAddress>
    <secondaryAddresses>
                            < ipAddress > 10.0.0.2 < / ipAddress >
                            < ipAddress > 10.0.0.3 < / ipAddress >
    <>of theipAddress10.0.0.4</> of theipAddress
    </secondaryAddresses>
    <subnetPrefixLength>29</subnetPrefixLength>
                    < / addressGroup >
                < / addressGroups >
                < MTU > 1600 < / MTU >
    <enableProxyArp>false</enableProxyArp>
    <enableSendRedirects>true</enableSendRedirects>
    <isConnected>true</isConnected>
    <inShapingPolicy>
    <averageBandwidth>20000000</averageBandwidth>
    <peakBandwidth>20000000</peakBandwidth>
    <burstSize>0</burstSize>
                    < enabled > true < / enabled >
                    < inherited > false < / inherited >
    </inShapingPolicy>
    <outShapingPolicy>
    <averageBandwidth>20000000</averageBandwidth>
    <peakBandwidth>20000000</peakBandwidth>
                    < burstSize > 0 < / burstSize >
                    < enabled > true < / enabled >
                    < inherited > false < / inherited >
    </outShapingPolicy>
            < / vnic >
        < / vnics >
    <cliSettings>
    <>theusernameadmin</> user name
    <password># 123456 PasssworD</> password
    <remoteAccess>true</remoteAccess>
        < / cliSettings >
    < / edge >


    Thank you very much

    D.

    Finally, I discovered.

    You must add the header without papers:

    XML:application / xml

    Don't ask me why this non-standard header is not documented.

    D.

  • REST API: How to create e-mail/landing page with static/dynamic content?

    With the REST API, it seems that you can create/update the contents of an e-mail or a landing page by specifying html with the type "RawHtmlContent". How it works when this e-mail or a landing page includes a shared or dynamic content? What is the recommended method to create or update an e-mail/landing page and add a new shared or dynamic, content or update the "reference"?

    Unfortunately this is not currently supported by our API.  However, we are building a new point extension called content Cloud that can solve your use case.

  • Can not do a query with the REST api

    Hello

    After discovering that the use of the standard SOAP API what is like poking yourself in the eye with a sharp stick, I try to use the REST API. At first, I tried to exercise it through the extension of POSTMAN on Chrome. But I have no joy.

    Can I use caller ID to get the URL, so I know that my authentication is OK. But all other calls give me:

    Failure of 403 XSRF Protection


    Is an example of a call, that I'm trying:

    https://secure.Eloqua.com/API/rest/1.0/data/[email protected] & Count = 1

    I can't find any reference anywhere to this error 403.

    Help!

    Thank you

    Simon

    Hi Simon,.

    Looks like you're client (web browser) might have stored credentials for Eloqua, probably in the cookies collection. If you try to delete your cookies and rerun the query API with basic authentication, it should work.

    Hope this helps and please let us know if you need more information.

    Thank you

    Fred

Maybe you are looking for