A new Flexera Community experience is coming on November 25th. Click here for more information.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bash script to call App Portal APIs

We would like to submit an HTTP GET using curl for createRequest.  When I try it now I get an "Error Processing Questions" error despite sending the recommended value for "strQuestions" from here: https://docs.flexera.com/appportal/2022r1/ag/Content/helplibrary/AP_APIRef_createRequest.htm#apiref_3823587126_1124642

Is anyone doing this today?   Could someone provide an example like what is posted here, but with a bash script - https://community.flexera.com/t5/App-Broker-Forum/How-do-you-call-the-App-Broker-Web-Service-through-PowerShell/m-p/97754 ?

 

Thank you!!

 

 

(1) Solution
CharlesW
By Level 12 Flexeran
Level 12 Flexeran

Matt,
     I have no idea if this will help or not.. I really do not do much with cURL, so I generated the below cURL command using postman.. I basically made a SOAP call using postman, and then had Postman convert it to cURL

curl --location --request POST 'http://10.75.204.65/esd/api.asmx?op=createRequest' \
--header 'Content-Type: text/xml' \
--header 'Authorization: Basic YXBwcG9ydGFsXGNoYXJsZXN3ZWJlcjpYamF2YTEyMw==' \
--header 'Cookie: ASP.NET_SessionId=lp3jfhpnbnoryfurjnhoq0nm; RequestedUrl=/esd/api.asmx' \
--data-raw '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <createRequest xmlns="http://sccmexpert.local/API">
      <iPackageID>1013</iPackageID>
      <strMachine>sql2016shared</strMachine>
      <strRequester>appportal\charlesweber</strRequester>
      <strTargetUser>appportal\CharlesWeber</strTargetUser>
      <bUseApproval>false</bUseApproval>
      <bSendEmail>false</bSendEmail>
      <strQuestions>
       </strQuestions>
    </createRequest>
  </soap:Body>
</soap:Envelope>'

View solution in original post

(2) Replies
CharlesW
By Level 12 Flexeran
Level 12 Flexeran

Matt,
     I have no idea if this will help or not.. I really do not do much with cURL, so I generated the below cURL command using postman.. I basically made a SOAP call using postman, and then had Postman convert it to cURL

curl --location --request POST 'http://10.75.204.65/esd/api.asmx?op=createRequest' \
--header 'Content-Type: text/xml' \
--header 'Authorization: Basic YXBwcG9ydGFsXGNoYXJsZXN3ZWJlcjpYamF2YTEyMw==' \
--header 'Cookie: ASP.NET_SessionId=lp3jfhpnbnoryfurjnhoq0nm; RequestedUrl=/esd/api.asmx' \
--data-raw '<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <createRequest xmlns="http://sccmexpert.local/API">
      <iPackageID>1013</iPackageID>
      <strMachine>sql2016shared</strMachine>
      <strRequester>appportal\charlesweber</strRequester>
      <strTargetUser>appportal\CharlesWeber</strTargetUser>
      <bUseApproval>false</bUseApproval>
      <bSendEmail>false</bSendEmail>
      <strQuestions>
       </strQuestions>
    </createRequest>
  </soap:Body>
</soap:Envelope>'

Just what we needed!  Thank you Charles!