Using Python to interact with the API (Orchestrator 5.1.2)

So I'm having a problem for POST operation (lower to-# start execution) to work. All, I tried resulted in a 400 error. I also tried just post variable parameter using a string and the JSON ({' settings' :...}). If anyone can give me a little help to find what I'm doing wrong here it would be appreciated.

# Retrive API URL for a workflow
import pycurl, json, pprint
from io import BytesIO

data = BytesIO()
orchestrator_url = "https://server.domain.com:8281/api/workflows?conditions=name=Workflow%20Name"
user_pwd = "user:******"

c = pycurl.Curl()
c.setopt(pycurl.URL, orchestrator_url)
c.setopt(pycurl.USERPWD, user_pwd)
c.setopt(pycurl.SSL_VERIFYHOST, 0)
c.setopt(pycurl.SSL_VERIFYPEER, 0)
c.setopt(c.WRITEFUNCTION, data.write)
c.perform()

response = json.loads(data.getvalue())

for attribute in response['links'][0]['attributes']:
   if attribute['name'] == 'itemHref':
     orchestrator_url = attribute['value'].decode("utf-8").encode("ascii","ignore")
     break

# Start execution
data = BytesIO()
orchestrator_url += "executions"


parameters = {}
parameters['parameters'] = [1]
parameters['parameters'][0] = {}
parameters['parameters'][0]['scope'] = "LOCAL"
parameters['parameters'][0]['type'] = "string"
parameters['parameters'][0]['name'] = "environment"
parameters['parameters'][0]['value'] = {}
parameters['parameters'][0]['value']['value'] = "Production"
parameters['parameters'][0]['value']['objectType'] = "string"

post =  json.dumps(parameters)
# post = {"parameters": [{"scope": "LOCAL", "type": "string", "name": "environment", "value": {"value": "Production", "objectType": "string"}}]}
# post = json.dumps({"parameters": [{"scope": "LOCAL", "type": "string", "name": "environment", "value": {"value": "Production", "objectType": "string"}}]})


c.setopt(pycurl.URL, orchestrator_url)
c.setopt(pycurl.USERPWD, user_pwd)
c.setopt(pycurl.SSL_VERIFYHOST, 0)
c.setopt(pycurl.SSL_VERIFYPEER, 0)
c.setopt(c.WRITEFUNCTION, data.write)
c.setopt(pycurl.HTTPHEADER, ['Accept: application/json;v=5.1.1', 'Content-Type: application/json;v=5.1.1'])
c.setopt(pycurl.POST, 1)
c.setopt(pycurl.POSTFIELDS, post)
# c.setopt(pycurl.POSTFIELDS, '%s' % post)
c.perform()

response = json.loads(data.getvalue())

c.setopt(pycurl.HTTPHEADER, ['Accept: application/json;v=5.1.1', 'Content-Type: application/json;v=5.1.1'])
c.setopt(pycurl.POST, 1)
c.setopt(pycurl.POSTFIELDS, '%s' % post)
c.perform()


response = json.loads(data.getvalue())


Just for reference. The JSON for a completed:

{u'endDate': 1419616471963,
u'href': u'https://server.domain.com:8281/api/workflows/ae280954-0442-4342-a60d-374ed0f9772e/executions/402880114a7d7df6014a87bc467f0037/',
u'id': u'402880114a7d7df6014a87bc467f0037',
u'inputParameters': [{u'name': u'environment',
                       u'scope': u'LOCAL',
                       u'type': u'string',
                       u'value': {u'objectType': u'string',
                                  u'value': u'Production'}}],
u'name': u'Workflow Name',
u'outputParameters': [{u'name': u'output',
                        u'scope': u'LOCAL',
                        u'type': u'string',
                        u'value': {u'objectType': u'string',
                                   u'value': u'e4ecf81b7384'}}],
u'relations': {u'links': [{u'href': u'https://server.domain.com:8281/api/workflows/ae280954-0442-4342-a60d-374ed0f9772e/executions/',
                            u'rel': u'up'},
                           {u'href': u'https://server.domain.com:8281/api/workflows/ae280954-0442-4342-a60d-374ed0f9772e/executions/402880114a7d7df6014a87bc467f0037/',
                            u'rel': u'remove'},
                           {u'href': u'https://server.domain.com:8281/api/workflows/ae280954-0442-4342-a60d-374ed0f9772e/executions/402880114a7d7df6014a87bc467f0037/logs/',
                            u'rel': u'logs'},
                           {u'href': u'https://server.domain.com:8281/api/workflows/ae280954-0442-4342-a60d-374ed0f9772e/executions/402880114a7d7df6014a87bc467f0037/state/',
                            u'rel': u'state'}]},
u'startDate': 1419616470657,
u'startedBy': u'[email protected]',
u'state': u'COMPLETED'}


I have collected a few journal entries of debugging: they do not seem to be very useful if...

2014 12-30 10:04:16.716 - 0500 INFO [SecurityTokenServiceImpl] acquired a user token: user

2014 12-30 10:04:16.903 - 0500 INFO [SecurityTokenServiceImpl] acquired a token for the user: {name: user, domain: domain.com}

2014-12-30 10:04:16.919 - 0500 DEBUG [CallCollectorCenter] record call collector: VSOFactory-cached

2014-12-30 10:04:16.919 - 0500 DEBUG [VSOFactoryClient] < < shared connection factory!

2014-12-30 10:04:16.919 - 0500 DEBUG [VSOFactoryClient] create Session

2014-12-30 10:04:16.919 - 0500 DEBUG [VSOFactoryClient] Session created

And the typical response, I'll be back:

HTTP status 400-


type of Status report

message

Description The request sent by the client is syntactically incorrect ().


JBossWeb/2.0.1.GA

OK, a few more things to check:

(1) would you try without 'extended': attribute 'LOCAL '?

(2) you could try with "scope": "local" (LOCAL lowercase)

(3) you could try calling the POST operation not Python code, but using a tool of browser-based REST client or 'curl' command line?

Subsequently another user thread https://communities.vmware.com/message/2260188 reported that this format (without "extended") worked for him.

Tags: VMware

Similar Questions

  • Is it possible to interact with the guest virtual computer console using PowerCLI?

    I'm trying to automate the installation of Linux on the ESXi systems.  Installing Linux is all from the command line.  Is there a way that I can interact with the console or shell comments VM using PowerCLI?

    In my view, customization works only with officially listed linux distributions.

    Kind regards

    Nedko Nedev

    PowerCLI development team

  • I can create forms in the designer, but when I use a data model, I can't interact with the form

    In LiveCycle Designer ES2 I can create a form and then preview and interact with the form.

    This guess I just build objects by dragging the pieces pre-made object on the form (for example, text field) - which I can name, wrap in subforms something - I can add actions and all is well.  When I preview the PDF, I can enter data in the fields, click on the radio buttons, making things appear that everything is great.

    But LC ES2 is based on the data driven development model by, so in my case I need a form guide as well as the form - so it's better to have a model of data created in the first place - and then create the form based on the data model - then build guide form based on the data model - it is also a good idea, and I'm cool with that.

    My problem is that when I'm building a data model (just for a quick and dirty development demo, not associated with services back-end or databases) and I create the form based on the data model - I can't interact with all objects in the preview pane form - further when I launch the workspace and call my process that contains the form - I even can't interact with the form.

    What I am doing wrong?

    Summons - I can create a form and interact with it - but If I start with a data model and generate the form based on that - I can't interact with the form (option buttons click-I can not enter data in form fields - etc) what causes this?  What should I do to use a data model and be able to create an interactive form? >

    Does anyone know what causes this problem?  It's driving me crazy.

    Thank you-

    Ben

    You do not hurt anuthing. It works as advertised. When you generate a Guide and work with a fml data model designer you will only create a static non-fillable PDF file. This is because when you import the model in the designer of the model must be turned in a schema. The schema may not represent constraints and validations can be encoded in the model. The only thing that can be maintained is the structure, so Designer forbids you to buidl an interactive form.

    If you know what you're doing, you could take the data it is generated from the Guide and merge on a XDP template file that you create (unless he models in a first time - you can use the sample XML data as a starting point) using LC forms. Edowmside, is that if there are constraints and rules you would have to code them in the model as well. That's the way it is now there, but it will improve over time, as more of the ability of the model is exposed to the XFA world.

    Hope that helps

    Paul

  • How many still for my application to interact with the Timesten database?

    Hi all, still how much for my application to interact with the Timesten database?
    As far as I know, we can connect directly to the database without network load that improves performance, should my application only to specify the DSN name under the name of DSN Manager data? There is no document to clarify that clearly.
    The other approach is c/s connection and there are 3 commucation protocols, such as plain TCP/IP, sockets, UNIX domain and the CPI, right?

    Yes, that's correct. (Preferably) direct mode when the application and TimesTen are on the same machine. UNIX domain socket and shared memory IPC server local (only for cases of special purpose given that the direct mode is faster and more) and normal TCP/IP client/server (local or remote).

    The specific details on how the application connects depends on which API that it uses (ODBC, OCI, Pro * C, JDBC, ODP .NET). For ODBC and JDBC, you must specify a data source name and use the driver corresponding (direct-mode driver or client driver). For the OIC that is configured through SQL * Net and TNSNAMES. ORA and for ODP .NET, I don't remember without it looking up. Please see the TimesTen for relevant API documentation for full details.

    Chris

  • Interaction with the BlackBerry via USB

    This may be the wrong forum for this question, and if so, please point me to one that is more appropriate, because it doesn't seem to be a forum of developers on this segment of use cases.

    Is there a material that interacts with the BlackBerry through the USB connection?  The BlackBerry Desktop Manager can make quite a range of things with the BlackBerry via a USB connection.  None of this is publicly available or documented?  If this isn't the case, it is fine, please tell me if I can stop looking in vain for him.

    There was an example of code, packed with JDE 4.1, I think, who communicates with the BlackBerry via USB using BBDevMgr as a resource com  There is a lack of documentation of this interface and its capabilities and limitations.  It is still supported?  If so, where can I find the documentation for it?

    Thank you for your time.

    It is still supported.  You can find the documentation in the "use USB or serial port connections" section of the BlackBerry Java development environment development Guide found here:

    http://NA.BlackBerry.com/eng/support/docs/subcategories/?usertype=21&category=BlackBerry+Java+applic...

  • "Error while interacting with the scanner: the selected scanner was not found." Called brother and my MFC 7360N works very well with other programs to scan - only problem with Adobe Acrobat Pro 11.

    "Error while interacting with the scanner: the selected scanner was not found." Called brother and my MFC 7360N works very well with other programs to scan - only problem with Adobe Acrobat Pro 11.

    Hi davidd67669685,

    Please provide the exact point of the software & OS installed on your system. Also check if it is there any update available for the software after going through "help > check updates.

    Follow this thread to reset the Acrobat preferences:- How to reset preference settings in format Acrobat.

    You can check after connecting this scanner locally to the system if asked its connected on network & then look for the same thing.

    Please refer to this article:- of the troubleshooting tips for scanning questions when using Acrobat

    If the problem persists ask please check with another user account.

    Kind regards

    Christian

  • The difficulty to remove the transitions with the api

    Hi friendly friends from Adobe.

    I can't remove transitions with the api for creating. I use QE, (simplified loop) thusly:

    app.enableQE ();

    qe.project.getActiveSequence () .getVideoTrackAt (0) .getTransitionAt (0) .remove)

    ... and it works, but there is a leak memory, so I can't run the script twice. I chatted to bbb_999 offline & he suggested that I do not use QE, so now I have this:

    App.Project.sequences [0] .videoTracks [0] .transitions [0]. Unbind (true)

    ... that returns Undefined, and the transition is not removed. I think that I am not by the way of the correct setting in the unbind method. Any help would be appreciated!

    As a matter side: How can I find the list of arguments for methods, because there is no documentation? I get pretty exhausted DOM ExtendScript Toolkit of navigation and then guess what might be the method arguments.

    See you soon,.

    Raphael

    The first method is the right one; Unbind() does not remove a transition. What is the problem of leak memory that you meet?

    > How can I find the list of arguments for methods, because there is no documentation?

    Look in PProPanel and if its use is not exercised here, ask.

    While some screen movie tutorials are being developed, no additional documentation is currently scheduled. If all goes well, a comforting thought; There are > 140 panels in the wild, and none of them had more documentation do you.

  • This protocol uses Agent to communicate with the Service

    Hello everyone, this is my first post in this forum and I want to shoot a question if someone could help me.

    I guessed that the communication between the api and the server at the time where the user will put api HQAPi = new HQApi (...) is with the http or https protocol, depends on the value introduced in the conf file.

    I would like to know what protocol uses agent to communicate with the service. I would like your ideas.

    Thanks in advance.

    Hello

    Welcome to the forums!

    Could you clarify your question a bit more? Looking for agent-> server HQ communication or agent-> communication monitored service?

    If this is an agent-> HQ server then they communicate with each other using foam which is a specific HQ communication protocol.

    If he's an agent-> monitored service it depends on the service.

  • Mice do not interact with the panels.

    I have CS6 wich I just DL a few weeks ago for the school, I do not use plug-ins or other add on software. The problem is that my mouse will not interact with the signs, (that is to say of layers, swatches, and such a) in InDesign. So far Photoshop Illustrator and bridge all works fine it's just ID I have problems with. On the panels I can get it to open the group but he has no interaction with fine details, selecting layers, double click on name to rename locking display and open the layer options, create new layer button will also does not work, I can use the options in the upper right part of the Panel for some things , but it let me limited on what can be done. I can not even use my mouse to switch between the layers. An idea on what can be causeing this and what I can do about it. (Yes, my mouse works, he is in charge and interacts with other software and games without a problem)

    Win 7? Disable Aero or set the font to 100% in exploitation

    System.

  • Get-view FileManager = vCenter only? How to interact with the data without her store?

    Hello

    I am trying to create a folder directly on a data store and copy a vmx file.  What I've read I need to use Get-file manager mode, but this seems to be only available on vCenter.

    Is there anyway to interact with the data using PowerCLI store when it connects directly to a box of ESX?

    Thanks for your help,

    KeV

    The shortcut notation

    Get-View FileManager
    

    is not available when connected to an ESX host.

    But you can get the object as follows

    Get-View (Get-View ServiceInstance).Content.FileManager
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Interaction with the user

    We try to create a project where we show software simulations, and we'll use Captivate to do this. We also want to add a feature to allow the user to 'try', which means that they take control of the mouse and can really interact with the demonstration. Is this possible?

    Hello!

    It is possible to have someone software "try". The key is in the original game to the top of your record of the screenshots of the software. There is a difference between registration of a "demonstration" by report to record a 'Simulation '.

    When you are ready to register and get the screenshots you want to make sure that Captivate is in the correct mode. Before you click the record button, click the Options button in the lower left corner. One of the options that is displayed is the recording Mode. Make sure it is set to Simulation Training.

    Once you have training Simulation, Captivate automatically includes the boxes click, captions, highlights, etc. that you save your screenshots. To check what Captivate includes in regards to interactivity, click the settings button next to the option of recording Mode. Select the components you want people of sages they you can see your movie.

    With these settings Captivate all your screenshots record then becomes a simulation where people have to interact with what they see on the screen.

    I know that this has been detailed, but I hope it helps. Good luck to fill your training modules.

  • Can I use an SD card with the new MacBook?

    Looking to buy a new MacBook. From what I can tell there is no SD card reader.  I don't see any accessory adapter for SD readers either.  Is it possible to use an SD card with the new MacBook?  Thank you!

    Only I can find is for iOS devices > > http://www.apple.com/shop/product/MJYT2AM/A/lightning-to-sd-card-camera-reader?f node = 91

    On the SDXC - Apple Support and SD card slot

    I hope someone will find an adapter for you.

  • Is it possible to use iCloud shares photos with the two opening and Photos at the same time?

    Is it possible to use iCloud shares photos with the two opening and Photos at the same time?

    Non - PEAK is not a feature of iPhoto or Aperture - this is new with Photos

    LN

  • Windows Mail is not interacting with the server.

    When Windows Mail (WM) is open, it will download 2 of each incoming e-mail.  Conducted a comprehensive analysis of the system, no problem.  Talked with our server provider, we ran the test emails to see if WM was interacting with the server and it is not.  Is also not to keep my ID and password to log on the server. Y at - it an update I missed it to avoid these problems?

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas:

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    It causes a frequent there have new antivirus scan program messages.  Uninstall your AV program and reinstall without any mail analysis feature.  You will be just as safe.

    Another common cause is to have two e-mail accounts, referring to the same mailbox.  The send/receive operation can access two accounts at the same time and both can download the message even if they both refer to the same mailbox. Brian Tillman [MVP-Outlook]

  • Difficulty in interacting with the Web site with Windows 8 and touchscreen

    I am trying to interact with a website (www.khanacademy.com) to work on my math skills and I meet a lot of frustration.

    One of the things that Khan fact is that it is an interactive learning site, but when I try to interact with the notebook on the Web site through my touch screen it's just little dots. Also when I try to select and drag a shape to rearrange in a group I can move the form around a 1/4 inch and then the age of the web moves as I tried to move the page. And if I try to double-click the form it zooms in on the page.

    Can someone help me with this? I really need to be able to work on my math stuff, and one of the reasons for which I received a computer with a touchscreen was if I could interact with this type of websites.

    I want to x 360 HP TouchSmart running Windows 8.1

    Altogether.  Khan must references these two pages to find out how to program their site correctly:

    Setting the touch-action property

    Prepare your site contact

    Guidelines for the construction of touch-friendly Web sites

Maybe you are looking for

  • Extension of expansion Port 3 cable?

    I found the expansion port 3 on my Bay docking station is much too short to comfortably connect to my laptop. Is there anywhere I could get an extension for this? I searched all over the internet and have failed to find something like this, but am de

  • Satellite P875-10U - what drivers should I install

    Hello! A few days ago bought a new laptop. Today I did the format, and I wanted to ask you, what drivers should I install, because I think all the drivers are not necessary, but I want your opinion, I have already installed the Atheros Ethernet drive

  • Can I upgrade Edition Vista Home premium to windows 7 using vista anytime upgrade for free?

    anytime upgrade is included with the purchase of windows vista can I upgrade Edition Vista Home premium to windows 7 using vista anytime upgrade for free?

  • Impossible to install the software for WHS Probook 4720 2011

    I have a strange problem.  In the past, I had this laptop just awesome to work with my Windows Home Server 2011 probook and to perform backups.  However, more than a month, I was not able to connect to my laptop and Support HP told me to reinstall Wi

  • dynamic domain names SEO

    I'll have a test question a form field for a null condition.  The names of the fields in the form are created dynamically as the creation of the form that is based on a query that returns a list of documents uploaded by a user. Each line contains the