Layer7 API Management

  • 1.  Can we update the Swagger File in the Developer Portal using the Portal APIs?

    Posted Mar 05, 2019 09:38 AM

    Hello,

     

    We would like to automate the Swagger file updates and I was wondering if we could use the API PUT Operation that is listed in the API Explorer of the Admin Tenant.

    I can see this as example body:

    {
      "Uuid": "UUID_OF_API",
      "Name": "apiName2",
      "Version": "2",
      "PublishedByPortal": true,
      "ApiEulaUuid": "c9406345-eb76-11e3-b0cd-000nosaj86a8",
      "PrivateDescription": "",
      "PortalStatus": "ENABLED",
      "AccessStatus": "PUBLIC",
      "Description": "",
      "SsgUrl": "proxyUrl1",
      "PolicyEntities": {
        "results": [
          {
            "PolicyEntityUuid": "72093738-871a-45bd-b114-ad3a61893ac0",
            "PolicyTemplateArguments": {
              "results": [
                {
                  "Type": "boolean",
                  "ApiUuid": "{{GENERATED_GUID}}",
                  "Label": "Debug Mode",
                  "Value": "true",
                  "PolicyTemplateUuid": "72093738-871a-45bd-b114-ad3a61893ac0",
                  "Name": "debugMode"
                }
              ]
            }
          }
        ]
      },
      "AuthenticationType": "NONE",
      "AuthenticationParameters": "{}",
      "CustomFieldValues": {
        "results": []
      },
      "ApiLocationUrl": "here.com",
      "SpecContent": "data:;base64,ew0KICAic3dhZ2dlciI6ICIyLjAiLA0KICAiaW5mbyI6IHsNCiAgICAidmVyc2lvbiI6ICIxLjAuMCIsDQogICAgInRpdGxlIjogIlN3YWdnZXIgUGV0c3RvcmUiLA0KICAgICJkZXNjcmlwdGlvbiI6ICJBIHNhbXBsZSBBUEkgdGhhdCB1c2VzIGEgcGV0c3RvcmUgYXMgYW4gZXhhbXBsZSB0byBkZW1vbnN0cmF0ZSBmZWF0dXJlcyBpbiB0aGUgc3dhZ2dlci0yLjAgc3BlY2lmaWNhdGlvbiIsDQogICAgInRlcm1zT2ZTZXJ2aWNlIjogImh0dHA6Ly9zd2FnZ2VyLmlvL3Rlcm1zLyIsDQogICAgImNvbnRhY3QiOiB7DQogICAgICAibmFtZSI6ICJTd2FnZ2VyIEFQSSBUZWFtIg0KICAgIH0sDQogICAgImxpY2Vuc2UiOiB7DQogICAgICAibmFtZSI6ICJNSVQiDQogICAgfQ0KICB9LA0KICAiaG9zdCI6ICJwZXRzdG9yZS5zd2FnZ2VyLmlvIiwNCiAgImJhc2VQYXRoIjogIi9hcGkiLA0KICAic2NoZW1lcyI6IFsNCiAgICAiaHR0cCINCiAgXSwNCiAgImNvbnN1bWVzIjogWw0KICAgICJhcHBsaWNhdGlvbi9qc29uIg0KICBdLA0KICAicHJvZHVjZXMiOiBbDQogICAgImFwcGxpY2F0aW9uL2pzb24iDQogIF0sDQogICJwYXRocyI6IHsNCiAgICAiL3BldHMiOiB7DQogICAgICAiZ2V0Ijogew0KICAgICAgICAiZGVzY3JpcHRpb24iOiAiUmV0dXJucyBhbGwgcGV0cyBmcm9tIHRoZSBzeXN0ZW0gdGhhdCB0aGUgdXNlciBoYXMgYWNjZXNzIHRvIiwNCiAgICAgICAgInByb2R1Y2VzIjogWw0KICAgICAgICAgICJhcHBsaWNhdGlvbi9qc29uIg0KICAgICAgICBdLA0KICAgICAgICAicmVzcG9uc2VzIjogew0KICAgICAgICAgICIyMDAiOiB7DQogICAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiQSBsaXN0IG9mIHBldHMuIiwNCiAgICAgICAgICAgICJzY2hlbWEiOiB7DQogICAgICAgICAgICAgICJ0eXBlIjogImFycmF5IiwNCiAgICAgICAgICAgICAgIml0ZW1zIjogew0KICAgICAgICAgICAgICAgICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvUGV0Ig0KICAgICAgICAgICAgICB9DQogICAgICAgICAgICB9DQogICAgICAgICAgfQ0KICAgICAgICB9DQogICAgICB9DQogICAgfQ0KICB9LA0KICAiZGVmaW5pdGlvbnMiOiB7DQogICAgIlBldCI6IHsNCiAgICAgICJ0eXBlIjogIm9iamVjdCIsDQogICAgICAicmVxdWlyZWQiOiBbDQogICAgICAgICJpZCIsDQogICAgICAgICJuYW1lIg0KICAgICAgXSwNCiAgICAgICJwcm9wZXJ0aWVzIjogew0KICAgICAgICAiaWQiOiB7DQogICAgICAgICAgInR5cGUiOiAiaW50ZWdlciIsDQogICAgICAgICAgImZvcm1hdCI6ICJpbnQ2NCINCiAgICAgICAgfSwNCiAgICAgICAgIm5hbWUiOiB7DQogICAgICAgICAgInR5cGUiOiAic3RyaW5nIg0KICAgICAgICB9LA0KICAgICAgICAidGFnIjogew0KICAgICAgICAgICJ0eXBlIjogInN0cmluZyINCiAgICAgICAgfQ0KICAgICAgfQ0KICAgIH0NCiAgfQ0KfQ==",
      "SpecFilename": "swagger.json",
      "SpecFilesize": 1438,
      "OrgUuid": "4c35f9cd-8eb2-11e3-ae6b-000c2911a4db"
    }

    Is there a way to specify a path to the swagger.json on the above?

    Stephen_HughesGARMA26manab01



  • 2.  Re: Can we update the Swagger File in the Developer Portal using the Portal APIs?
    Best Answer

    Broadcom Employee
    Posted Mar 05, 2019 01:10 PM

    Good morning,

     

    The swagger file contents must be in the "data:;base64,...." segment of the payload and the "SpecFilename": "..." element needs to outline just the file name without any path. This process can automate the updating of the swagger file as long as the data is embedded in the payload.

     

    Sincerely,

     

    Stephen Hughes

    Broadcom Support



  • 3.  Re: Can we update the Swagger File in the Developer Portal using the Portal APIs?

    Posted Mar 06, 2019 07:28 AM

    Thank you Stephen,

     

    That makes total sense.

     

    Regards

    Malvina