vShield does REST APIs support JSON?

Hello

I tried on vShield REST API. Support the JSON content type? All of the examples I see is using xml. I am able to get JSON content. But when I try to create/update it gives me the error.

This gives me the answer in JSON format:

curl k u < user >: < pass > h ' Accept: application / json ' https:// /API/2.0/services/ipset/ipset-150 < ip >

But if I try:

curl k u < user >: < pass > x POST h "Accept: application / json ' h ' Content-Type: application / json" d "{'description': 'test FPS',"name":" FPS-test-1', 'value': '22.22.22.1', 'revision': 0 '} " https:// /api/2.0/services/ipset/dvportgroup-1265 < ip >

I get the following error:

The HTTP 400 - the request sent by the client state is syntactically incorrect.

Please help me with this.

Kind regards

Skander

I think that our RESTful systems only manage the entry of XML format.  This is more of a general statement that specific POSSIBLE.

You can file a request for assistance for a feature request?  Some people asking about it internally as a possible use scenarios to see what the benefits would be there.  If you make an SR, private Message me please the SR number.

Tags: VMware

Similar Questions

  • More quick REST API / JSON approaches to the interviews of the OPA?

    I recognize there are services / libraries that can convert an OPA Web Service deployment on the hub to a JSON / REST API.  (Examples: Mashape I used for the other REMAINS in the SOAP proxy).

    But, is there a consensus on the more common approach / best to this operation?  Is there an approach that may be more in line with the future development of the OPA hub around REST API?  I think I saw something with Oracle Cloud Computing Mobile Service, but I cannot find enough documentation to the CEP with.

    It occurs to me, that instead of researching the topic for an hour or more, I could have benefits more ask on the forum.

    Thank you

    Paul, my quick view is that whatever you do will be OK, because even once we add REST API, existing SOAP API will remain for backward compatibility reasons.

    It would also be impossible to build compatibility for something we have not designed yet, so I can't really all guide on what to do / avoid in order to simplify any possible future transition official rest API.

    Davin.

  • The REST api is supported by Eloqua?

    Hi guys,.

    I know that this seems to be an odd question at first, but bear with me.

    Recently, I created a few features to read certain Eloqua components.

    Then I came across some problems with th! api e REST and contacted support, at one point, they reported that the REST api was not officially taken in charge, is this true?

    Because using SOAP is no option for our programming environment and the major PART is just for the massif of the small amount of calls, we have to do.

    Hope you can give me a permission in this respect, because we do not want to create stuff on top of the api REST when we can never support on it.

    Through the REST API, you can do many things, not all supported.  This page lists the supported operations: management of Eloqua API use cases

  • JSON REST API format

    Hi all

    I want to read a specific attribute of my assets using the REST API and I would like this information in JSON, but I don't know how to do to get the attribute first, I used http://localhost:9080 / cs/REST/sites/mysite/types/BasicContent_C/assets/1374098078620 / , but the API returns the entire RESOURCE as XML, is it possible to return a single attribute? and it is possible to return this information in JSON format? or I need to read the information together and look for the attribute I want show?

    I want to show information about an external jsp page, I mean the other application.

    Best regards.

    Hello rvillamarin,

    I'm sorry but I needed the same two months ago and I have not found the way.

    Answer your questions, in my opinion:

    is it possible to return a single attribute? N ° you must retrieve the whole XML and look for the attribute on it.

    and it is possible to return this information in JSON? No. two options: create a model in WCSites in order to recover the attributes and present a JSON or create an intermediate java class to convert XML to JSON.

    or I need to read the information together and search for the attribute I want to show? So you can not do directly in the call of REST, you need to develop something.

    What we have done is to process the XML once we received in the client.

    It will be useful,

    Gerardo

  • Cannot add firewall rules using the REST API vShield App

    Hi all

    I get the following error

    "< errors > < error > < code > 100039 < / code > < description > Unmatched rules found in the configuration." "< / description > < / error > < / errors >.

    When you use the App API vSheild:

    POST https:// /API/2.0/app/firewall/dvportgroup-55/config < vsm-ip >

    Paylod XML:

    <? XML version = "1.0" encoding = "UTF-8" standalone = "yes"? >
    < VshieldAppConfiguration >
    < firewallConfiguration = "dvportgroup-55" the contextId >
    < layer3FirewallRule disabled = "false" priority = "none" id = "1021" >
    < action > allow < / action >
    < connected > false < / connected >
    < source >
    < address >
    < ipAddress > 172.30.68.212 < / ipAddress >
    < / address >
    < > 222 portInfo < / portInfo >
    < / source >
    < destination >
    < address >
    < ipAddress > 172.30.68.166 < / ipAddress >
    < / address >
    < application >
    < > 333 portInfo < / portInfo >
    < Protocol > 6 < / Protocol >
    < / application >
    < / destination >
    < / layer3FirewallRule >
    < / firewallConfiguration >
    < / VshieldAppConfiguration >

    Is anyone has seen this before or any idea why this might be happening?

    In addition, create a wall of fire to provide the variable "id"... How do I know which id to use to create a new firewall rule. I'm using id = "1021" I see one last created after quesrying API... but when you call it through automation, what will the process to define an id invalid?

    Thank you

    xar

    ID must be present, for the new rule Id must be '0' while that for others it should kept as what. The reason for this error which I believe is the same. Replacement of 1021 with 0 should solve this problem. http://blogs.VMware.com/security/2011/11/using-the-VShield-API.html should also be useful to start with vShield firewall App REST API.

    -Kone

  • 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

  • REST API updates

    I try to get the REST API of emails. I have the system of creating emails OK but when I try and update doing a query PUT with the ID of the email created in the URL and the ID in the JSON data (and noting of also changed) it blows upward with an internal server error.

    Any pointers people can give me?

    Hi Fred, I just went to get a few POST and PUT requests to see if I could spot anything and post it here.

    And this is now, works very well.

    * shrugs *.

    I'll keep an eye on it and post if I have more problems.

  • Mapping and querying objects for Contact with REST Api

    Hi all

    We are hoping to get some details on the DataCard management defined via REST API. Our implementation goal is to create Contacts and add the custom for each Contact object or to be more precise, add a set of map data for each Contact.

    At the present time, to associate a map Data Set (or custom object) to an existing contact, we provide a suite of fields in the custom when creating custom object object:

    new CustomObjectField  
    {
                                                                    name = "MappedEntityType",
                                                                    dataType = Enum.GetName(typeof(DataType), DataType.numeric),
                                                                    type = "CustomObjectField",
                                                                    defaultValue = "0"
                                                                },
                                                             new CustomObjectField
                                                                {
                                                                    name = "MappedEntityID",
                                                                    dataType = Enum.GetName(typeof(DataType), DataType.numeric),
                                                                    type = "CustomObjectField",
                                                                    defaultValue = "<ContactId>"
                                                                }
    
    

    This is the right approach? This is based on the information provided here: http://topliners.eloqua.com/community/code_it/blog/2012/05/31/eloqua-api-how-to-mapping-a-data-card-to-an-entity.

    The REST API would query the CustomObjects using the MappedEntityId value for the subsequent updates? If so, pointers on how to approach that?

    Thanks to ad.

    The REST API does not support this.  With the upcoming release of Eloqua, you will be able to update the MappedEntityID, as a query it.

  • 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

  • Uploading images using the REST API from PHP

    Does anyone at - he had success with the download of the images through the Eloqua Rest API using PHP?

    I have the final point, but I can't understand what kind of information needs to go the variable $data.

    That's what I currently have:

    <? PHP

    ini_set ("display_errors", 1);

    include("..) /.. ("/ eloquaRequest.php");

    $eloquaRequest = new EloquaRequest ('Instancename', 'username', 'password', 'https://secure.eloqua.com/API/REST/1.0');

    $data = new stdClass();

    $data-> image = file_get_contents("./easy.jpg");

    $data-> name = 'this is a file name ";

    $data-> filename = "luke.jpg";

    $data-> contentType = "image/jpeg";

    $response = $eloquaRequest-> message (' assets/image/content', $data);

    var_dump ($Response);

    The error I get is the following, but I think that it is a standard response, if your image does not go through correctly:

    Array (1) {[0] = > object (stdClass) #3 (2) {["type"] = > string(9) "FileError" ["requirement"] = > object (stdClass) #4 (3) {["type"] = > string (15) "SizeRequirement" ["maxSize"] = > int (52428800) ["minSize'] = > int (1)}}}

    Thank you

    Hi Phil,

    I had to find that it all the time, it took me several hours. I hope that it allows you to save a headache.

    Eloqua is very strict in dealing with the content-type header; See the comment here for a little explanation; REST API - download Images

    So what you need to do in PHP, is to build the query string for the image of yourself. You can do as follows (to adapt to your needs, not yet tested);

    <>

    [...]

    $img_path = '. / easy.jpg';

    $img_info = getimagesize ($img_path);

    $img_real = realpath ($img_path);

    $data = "-ELOQUA_BOUNDARY\r\n".

    ' Content-Disposition: form-data; name =-"Filedata\"; filename =------"".baseName ($img_real). » \"\r\n ».

    "Content-Type: '. '" $img_info ['mime']. "" \r\n ".

    "\r\n".

    file_get_contents() ($img_real). "" \r\n ".

    ' - ELOQUA_BOUNDARY - ';

    $headers = array ("Content-Length:".strlen ($data),"Content-Type: multipart/form-data;") Boundary = ELOQUA_BOUNDARY");

    $response = $eloquaRequest-> post (' assets/image/content', $data, $headers);

    ?>

    I have also adapted/reconstructed library Eloqua PHP in order to support the "BOLD" part. You must change the executeRequest function and add something like this to support change the request headers;

    curl_setopt ($this-> ch, CURLOPT_HTTPHEADER, $headers);

  • Using c# to access the REST API - 404 not found

    Hi all!

    Since there is currently no available c# example to access the REST API, I'm going at this from scratch using the Nuget - Microsoft.AspNet.WebApi.Client package.

    I was able to successfully implement a framework for code that is able to make a call to the base_uris method and successfully receive a response.

    I'm doing a transientDocuments call, but I still get a 404 not found error.  I'm hoping somewhere here may be able to enlighten.  I tried to use the current examples of Java to call REST API to get help on how to go about things.

    I create an instance of the AdobeDCREST class, and pass the BaseUrl (https://api.echosign.com/api/rest/v5/) and my key to integration.  When I make a call to the PostTransientDocuments method I pass into the path of the pdf file that I am trying to download.  PostTransientDocuments then deals with the creation of an object the HttpContent (StreamContent) of the file, and then adding the headers, ContentType and ContentDisposition.  The call to GetClient() will determine whether base_uris should be called still or not (I make the call to base_uris and storage of the api_access_point in a variable static for all other calls, as well as the java examples) and returns an object of the HttpClient with the access in the header already token.  The call to base_uris works and returns a https://api.na1.echosign.com/ api_access_point

    I then add/api/rest/v5 to the url access_point to call transientDocuments. Failure occurs during the call to PostAsync in transientDocuments with a 404 not found error.

    Here's the code I'm using to test things so far.  Any help would be greatly appreciated.  I've been spinning my wheels on that for too long already.

    using System;

    using System.Collections.Generic;

    using System.IO;

    using System.Linq;

    using System.Net.Http;

    using System.Net.Http.Headers;

    using System.Text;

    using System.Threading.Tasks;

    namespace Ivezt.Documents {}

    public class AdobeDCREST {}

    < Summary >

    A static variable that is defined by an initial call to GetBaseURIs() and used for all API calls later.

    < / Summary >

    Private Shared ReadOnly Property SERVICES_BASE_URL as string = string. Empty;

    < Summary >

    The end point of API to use.  This aspect will have to be changed if Adobe is moving to a new version of the API and we update this

    the code to use this new version.

    < / Summary >

    Private Shared ReadOnly Property API_URL as string = "api/rest/v5 /";

    < Summary >

    This BaseUrl is passed to the constructor and used to make a call to GetBaseURIs().

    < / Summary >

    private string m_strBaseUrl = string. Empty;

    < Summary >

    The IntegrationKey is passed to the constructor and must be added to the header of each API request.

    < / Summary >

    private string m_strIntegrationKey = string. Empty;

    public AdobeDCREST (string strBaseUrl, string strIntegrationKey) {}

    m_strBaseUrl = strBaseUrl;

    m_strIntegrationKey = strIntegrationKey;

    }

    private HttpClient GetDefaultClient() {}

    HttpClient client = new HttpClient();

    Add an Accept header for JSON format.

    customer. () DefaultRequestHeaders.Accept.Add

    (new MediaTypeWithQualityHeaderValue("application/json"));

    Add the access token

    customer. DefaultRequestHeaders.Add ("Access token", m_strIntegrationKey);

    customer feedback;

    }

    private HttpClient GetClient() {}

    If we have not yet the SERVICES_BASE_URL, then we must do a GetBaseURIs call

    If (SERVICES_BASE_URL. Length == 0) {}

    HttpClient baseClient = GetDefaultClient();

    Use the BaseUrl passed to the constructor

    baseClient.BaseAddress = new Uri (m_strBaseUrl);

    URI BaseURIs_Response = GetBaseURIs (baseClient);

    SERVICES_BASE_URL = string. Format ("{0} {1}", uris.api_access_point, API_URL);

    baseClient.Dispose ();

    }

    If (SERVICES_BASE_URL. Length == 0)

    throw new Exception ("failed to retrieve Adobe Document cloud Base URI");

    HttpClient client = GetDefaultClient();

    customer. BaseAddress = new Uri (SERVICES_BASE_URL).

    customer feedback;

    }

    public BaseURIs_Response GetBaseURIs(HttpClient client) {}

    Call base_uris

    HttpResponseMessage response = client. GetAsync ("base_uris"). Result;  Call blocking!

    If (answer. IsSuccessStatusCode) {}

    Analyze the response body. Blocking!

    answer back (BaseURIs_Response). Content.ReadAsAsync (typeof (BaseURIs_Response)). Result;

    }

    else {}

    throw new Exception (string. Format ("{0} ({1})", (int) response. ") StatusCode, response. ReasonPhrase));

    }

    }

    public TransientDocument_Response PostTransientDocuments (string strFilePath) {}

    Call transientDocuments

    Content the HttpContent = new StreamContent (new FileStream (strFilePath, FileMode.Open, FileAccess.Read));

    content. Headers.ContentType = new MediaTypeHeaderValue("application/pdf");

    content. Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data") {}

    Name = "file."

    FileName = 'Template.pdf.

    };

    HttpClient client = GetClient();

    HttpResponseMessage response = client. PostAsync ("transientDocuments", content). Result;  Call blocking!

    If (answer. IsSuccessStatusCode) {}

    Analyze the response body. Blocking!

    answer back (TransientDocument_Response). Content.ReadAsAsync (typeof (TransientDocument_Respons e)). Result;

    }

    else {}

    throw new Exception (string. Format ("{0} ({1})", (int) response. ") StatusCode, response. ReasonPhrase));

    }

    }

    }

    public class BaseURIs_Response {}

    public string web_access_point {get; set ;}}

    public string api_access_point {get; set ;}}

    }

    public class TransientDocument_Response {}

    public string transientDocumentId {get; set ;}}

    }

    }

    I think I found my problem.  I was not a multi-part post form data.  Once I changed this, everything worked as expected.  Here is an updated version of the PostTransientDocuments() method that works:

    public TransientDocument_Response PostTransientDocuments (string strFilePath) {}

    Call transientDocuments

    using (var = {GetClient() customer)}

    using (var content = new MultipartFormDataContent()) {}

    var multiplesContent = new StreamContent (new FileStream (strFilePath, FileMode.Open, FileAccess.Read));

    fileContent.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");

    fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data") {}

    Name = "file."

    FileName = 'Template.pdf.

    };

    content. Add (FileContent);

    HttpResponseMessage response = client. PostAsync ("transientDocuments", content). Result;  Call blocking!

    If (answer. IsSuccessStatusCode) {}

    Analyze the response body. Blocking!

    answer back (TransientDocument_Response). Content.ReadAsAsync (typeof (TransientDocument_Respons e)). Result;

    }

    else {}

    throw new Exception (string. Format ("{0} ({1})", (int) response. ") StatusCode, response. ReasonPhrase));

    }

    }

    }

    }

  • 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";
    
  • Initiate Orchestrator workflow through REST/Post with JSON body

    I am trying to initiate a workflow custom Orchestrator by issuing a MESSAGE from a client (in this case a violin) with the parameters in JSON format in the body.

    So far, I have been unable to get what anyone other than a 400 Bad Request and a "the request sent by the client was syntactically incorrect ()." in response.

    My environment is

    vCenter Orchestrator 5.1.1 Build 2942

    Java version 1.6.0.26

    The rest 1.0.1 Plugin is installed

    To verify that I am indeed able to initiate a workflow via a POST, I tested with XML in the MESSAGE body, just like a validation test. Given a data center TestDC2 I send the following

    POST https://10.144.20.62:8281/api/stream/d7614e92-0578-42b6-9c1f-04bd8a0533d3/executions / HTTP/1.1

    Authorization: Basic XXXXXXXXXXXXXXXXXXXX

    User-Agent: Mozilla/5.0 (Windows NT; Windows NT 6.1; en - us) WindowsPowerShell/3.0

    Content-Type: application/xml

    Host: 10.144.20.62:8281

    Content-Length: 311

    Connection: Keep-Alive

    " <-xmlns = execution context" http://www.VMware.com/VCO "> "

    < Parameters >

    < name of the parameter = "datacenterName" type = "string" >

    < string > TestDC2 < / string >

    < / parameter >

    < name of the parameter = "customerVMFolder" type = "string" >

    < string > aNewFolderVMFolder < / string >

    < / parameter >

    < / Parameter >

    < / execution context >

    I get a response of success

    HTTP/1.1 202 accepted

    Location: https://10.144.20.62:8281/api/stream/d7614e92-0578-42b6-9c1f-04bd8a0533d3/executions/ff8080813e847992013fa4ac4c2b046f /

    ETag: "0d41d8cd98f00b204e9800998ecf8427e".

    Content-Length: 0

    Date: Wednesday, July 3, 2013 13:15:22 GMT

    Server: vCO Server

    and 'aNewFolderVMFolder' folder is created under TestDC2

    The JSON equivalent

    POST https://10.144.20.62:8281/api/stream/d7614e92-0578-42b6-9c1f-04bd8a0533d3/executions / HTTP/1.1

    Authorization: Basic XXXXXXXXXXXXXXXXXXXX

    User-Agent: Mozilla/5.0 (Windows NT; Windows NT 6.1; en - us) WindowsPowerShell/3.0

    Content-Type: application/json

    Host: 10.144.20.62:8281

    Content-Length: 173

    Connection: Keep-Alive

    {

    'settings':]

    {'name': "datacenterName", "type": "string", "value": "TestDC2"},

    {'name': "customerVMFolder", "type": "string", "value": "aNewFolderVMFolder"}

    ]

    }

    gives a bad request

    HTTP/1.1 400 Bad Request

    Content-Type: text/html; charset = utf-8

    Content-Length: 965

    Date: Wednesday, July 3, 2013 13:21:02 GMT

    Connection: close

    Server: vCO Server

    < html > < head > < title > JBossWeb/2.0.1.GA - error report < / title > < style > <!-H1 {do-family: Tahoma, Arial, without serif; color: white; background-color: # 525 76; do-size: 22px ;}} H2 {do-family: Tahoma, Arial, without serif; color: white; background-color: # 525 76; do-size: 16px ;}} H3 {do-family: Tahoma, Arial, without serif; color: white; background-color: # 525 76; do-size: 14px ;}} BODY {do-family: Tahoma, Arial, without serif; color: black; background-color: white ;}} B {do-family: Tahoma, Arial, without serif; color: white; background-color: # 525 76 ;}} P {do-family: Tahoma, Arial, without serif;: white background; color: black; do-size: 12px ;}} A {color: black ;}} B.SID {color: black ;}} HR {color: # 525 76 ;} - > < / style > < / head > < body > < h1 > State HTTP 400 - < / h1 > < HR size = "1" = "noshade" noshade > < p-type > < b > < /b > < /p > < p > < b > report message < /b > < u > < / u > < / p > < p > < b > description < /b > < u > the request sent by} the client was syntactically incorrect (). < /u > < /p > < HR size = "1" noshade "noshade" = > < h3 JBossWeb/2.0.1.GA > < / h3 > < body / > < / html >

    After reading The POST CURL with vCO 5.1 REST API

    I also tried

    POST https://10.144.20.62:8281/api/stream/d7614e92-0578-42b6-9c1f-04bd8a0533d3/executions / HTTP/1.1

    Authorization: Basic YWRtaW46U2E1YWRtMW4 =

    User-Agent: Mozilla/5.0 (Windows NT; Windows NT 6.1; en - us) WindowsPowerShell/3.0

    Content-Type: application/json

    Host: 10.144.20.62:8281

    Content-Length: 266

    Connection: Keep-Alive

    {

    'settings':]

    {'name': 'datacenterName', 'type': 'string', 'field': 'local', 'value': {"value": "TestDC2", 'objectType': 'chain'}},

    {'name': 'customerVMFolder', 'type': 'string', 'field': 'local', 'value': {"value": "KamTestFolder", "objectType": "string"}}

    ]

    }

    with exactly the same results

    What I am doing wrong?

    Burke - State 415 code indicates the shift in the type of media, which is expected, because there is no Content-Type header

    KeyboardSlappingMonkey - I think that the body of the request should be something like the following (note the difference in the format of the value)

    {'settings': [{'name': 'datacenterName', 'type': 'string', 'value': {'chain': {'value': 'TestDC2'}}}, {"name": "customerVMFolder", "type": "string", "value": {'chain': {'value': 'KamTestFolder'}}}]}

    and you must pass the Content-Type header with the value application/json;v=5.1.1

    I hope this helps.

  • Access catalog getting and setting using the REST API

    I have a catalog I can see through the user interface which allows members to add in the tab share read-only, read/write or full control of the vCD. They do not appear anywhere that I can find when obtaining the catalog through the REST API.

    The REST API of 1.5 of vCloud Director documentation indicates that it supports the getting or setting user access to catalogs by using the link "conrolAccess". This link does not appear in the response to a GET the href of the catalog (admin or his substitute). Attempted to add "/ controlAccess" HREF catalogue translated by RESOURCE_NOT_FOUND.

    Hello

    Could be a bug in the documentation, try like this

    https://cloud/api/org/org-uuid/catalog/catalog-uuid/controlAccess - Fetch (GET)

    https://cloud/api/org/org-uuid/catalog/catalog-uuid/action/controlAccess - updated (AFTER)

    Kind regards
    Rajesh Kamal.

  • CPO 3.0 call a REST API

    I try to call a remote REST API that returns a JSON object.

    The call browser API looks like this

    http://IPAM-dev/phpipam/API/?app_id=API&controller=sections&action=read&ID=6

    Returns

    {'success': true, 'data': {'id': '6', 'name': "Telford subnets", 'description': '',' masterSection': '0', 'permissions': "{\"4\":\"1\ ""} strictMode ',' ': '1', 'subnetOrdering': null, 'order': null, "editDate": null, "showVLAN": '0', 'showVRF': '0' "}}

    When I try to use the OPC Web HTTP Request activity it fails with the following error

    Unable to send a content-body with this type of verb.

    I think the problem here is the content type. The default is application/xml; charset = utf - 8 in the activity, I tried to change this text, html and json, but still did not work. I can't let the emty content type in the activity.

    Anyone have any suggestion how to make a REST of CPO call using the activity Web HTTP request

    Try to change GET to POST (in the form of CALL-CPO_REST - RQ.png).  Sends the contents of the body generally requires a POST not a GET.

Maybe you are looking for