Layer7 API Management

Expand all | Collapse all

REST Management API - Solution Kit Manager - OAuthSolutionKit

Jump to Best Answer
  • 1.  REST Management API - Solution Kit Manager - OAuthSolutionKit

    Posted 12-11-2017 11:34 AM

    Hello,

     

     

    I want to install OAuthSolutionKit via curl and unable to make it. May I get some example code?

     

    Below is what I have tried:

     

    $ curl -X POST --user admin:password --insecure "file=@//OAuthSolutionKit-4.0.00-2339.sskar" https://10.10.1.251:9443/restman/1.0/solutionKitManagers
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    0 0 0 0 0 0 0 0 --:--:-- 0:00:07 --:--:-- 0curl: (7) Failed to connect to port 80: Connection refused
    100 267 0 267 0 0 133 0 --:--:-- 0:00:02 --:--:-- 117<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head><title>400 Bad Request</title></head>
    <body>
    <h1>Bad Request</h1>
    <h3>The request sent by the client was syntactically incorrect.</h3>

    </body>
    </html>

     

    Thanks a lot!



  • 2.  Re: REST Management API - Solution Kit Manager - OAuthSolutionKit

    Posted 12-11-2017 12:47 PM

    Good morning. The built in documentation for the restman interface https://<gateway>:8443/restman/1.0/doc/restDoc.html#1.0/solutionKits outlines how to install solution kits.

     

    Excerpt from the page:

     

    Install or upgrade a SKAR file.

    To Install
    • Upload a SKAR file using a POST request.
    • Set the encoding to multipart/form-data.
    • Set the file upload form-field name as file. The uploaded file has to be signed (*.sskar format).
    • Add other form-field name and value as needed.
      • entityIdReplace. Optional. To map one entity ID (from the SKAR) to an existing gateway entity ID to resolve entity conflict. Format [find_id]::[replace_with_id].
        • The Solution Kit Manager will replace the entity ID to the left of the double colon (::) with the entity ID to the right. E.g. set entityIdReplace to f1649a0664f1ebb6235ac238a6f71a6d::66461b24787941053fc65a626546e4bd.
        • Multiple values accepted (values from multiple fields with the same form-field name are treated as a list of values).
        • Mapping must be overridable from the solution kit author (e.g. mapping with srcId=[find_id] has SK_AllowMappingOverride = true). An error occurs when attempting to replace an non-overridable mapping.
      • solutionKitSelect: Optional. To select which solution kit in the uploaded SKAR will be installed and what instance modifier will be applied to the installed instance.
        • The value format of solutionKitSelect is [ID]::[IM], where "::" is a deliminator, [ID] is the GUID of the installed solution kit, and [IM] is the instance modifier applied to the installed instance. If [IM] is not specified, or the value of [IM] is empty, then the default instance modifier (empty value) is used.
        • If no solutionKitSelect provided, all solution kit(s) in the upload SKAR will be installed.
        • Multiple solutionKitSelect allowed: to specify multiple solution kits to install.
        • Note: the value of each instance modifier should not include "::", since "::" is a reserved delimiter.
      • instanceModifier. Optional. To specify an instance modifier applied to all installed solution kits. By default, if this form field is not specified or its value is empty, then this instance modifier uses a default value (empty value).
        • Applying instanceModifier is a quick way to apply a same instance modifier to a list of solution kits that have a same instance modifier. However, this instance modifier is only applied in the following two scenarios:
        • (1) No any solutionKitSelect specified (i.e., all solution kit(s) in the SKAR will be installed.)
        • (2) Some solutionKitSelect specified, but without [IM] specified.
        • Note: the value of each instance modifier should not include "::", since "::" is a reserved delimiter.
      • Passing values to the Custom Callback. Optional. All form-fields not listed above will be passed to the Custom Callback.

    Here's a cURL example (note the use of the --insecure option for development only):

    curl --user admin_user:the_password --insecure --form entityIdReplace=f1649a0664f1ebb6235ac238a6f71a6d::66461b24787941053fc65a626546e4bd --form entityIdReplace=0567c6a8f0c4cc2c9fb331cb03b4de6f::1e3299eab93e2935adafbf35860fc8d9 --form instanceModifier=AAA --form solutionKitSelect=33b16742-d62d-4095-8f8d-4db707e9ad52 --form solutionKitSelect=33b16742-d62d-4095-8f8d-4db707e9ad53::BBB --form "file=@//SimpleSolutionKit-1.1-20150823.skar.signed" --form MyInputTextKey=Hello https://127.0.0.1:8443/restman/1.0/solutionKitManagers

    Sincerely,

    Stephen Hughes

    Director, CA Support



  • 3.  Re: REST Management API - Solution Kit Manager - OAuthSolutionKit
    Best Answer

    Posted 12-11-2017 02:34 PM

    Hello Stephen,

    Really thanks for your quick reply!

     

    Couple things to highlight

    1) The cURL example seems not correct, '-X POST' is not included which in think by default is GET?

    2) The command I ran has syntax issue, after '--insecure' it is missing '--form'

    3) MyInputTextKey is mandatory

    4) The command below works for me:

    curl -X POST --user admin:password --insecure --form "file=@/c/Users/naichun/Downloads/layer7/OAuthSolutionKit-4.0.00-2339.sskar" https://10.10.1.251:9443/restman/1.0/solutionKitManagers --form MyInputTextKey=Hello

     

    Regards,

    Naichun



  • 4.  Re: REST Management API - Solution Kit Manager - OAuthSolutionKit

    Posted 12-11-2017 03:06 PM

    Naichun,

     

    I'm glad you were able to get it working. I'll have one of my team look into the embedded document for the variances you outlined and look to have them corrected.

     

    Sincerely,

     

    Stephen Hughes

    Director, CA Support



  • 5.  Re: REST Management API - Solution Kit Manager - OAuthSolutionKit

    Posted 07-11-2018 08:07 AM

    Hello Stephen/Naichun,

     

    I am also facing issue as invalid signed Zip: 'signed.dat' entry is missing while installing oauth solution kit using curl command . Please have a look on below command .

     

    curl -X POST --user admin:7layer --insecure --form "file=/home/prashant@//OAuthSoluti
    onKit-4.3.00-3789.sskar" https://Gatewayhostname:9443/restman/1.0/solutionKitManagers
    Invalid signed Zip: 'signed.dat' entry is missing

     

    FYI :  File that i have downloaded there is no extension like signed 

     

    File :OAuthSolutionKit-4.3.00-3789.sskar

     

    Thanks!
    Prashant Srivastava