0
votes

Within my automated build/deployment environment I want to use the WSO2 API Publisher Add API call (see https://docs.wso2.com/display/AM180/Publisher+APIs)

http://<host>:<port>/publisher/site/blocks/item-add/ajax/add.jag

to add/update APIs by supplying my Swagger json API definition files, generated from Java Spring @RestController classes with Swagger 1.2 annotations.

It appears this capability is not currently supported (see pending feature request https://wso2.org/jira/browse/APIMANAGER-3255 - Introduce a Publisher API to import swagger definition using a file or a URL).

However, there is an undocumented API which does support this which I have successfully tested:

https://host:port/publisher/site/blocks/item-design/ajax/add.jag? ... &swagger={<API SWAGGER DEFINITION GOES HERE>}

Is it safe to use this API? Please elaborate answer with explanation/background/future plans.

Where "safe" is defined as: Is it good practice to use the undocumented API? If yes, why isn't it documented? If not, why not, what are the risks of using it, what are the side effects, are future upgrades to WSO2 likely to break users of this API? Why does this API provide more functionality than the documented one?

Example:

https://localhost:9443/publisher/site/blocks/item-design/ajax/add.jag?
name=FOOAPI&
version=1.0.0&
provider=admin&
context=/home&
action=design&
visibility=public&
swagger=
{  
  "apiVersion":"1.0.0",
  "swaggerVersion":"1.2",
  "apis":[  
    {  
      "file":
      {  
        "apiVersion":"1.0.0",
        "basePath":"http://localhost:8280/home/1.0.0",
        "resourcePath":"/rest",
        "swaggerVersion":"1.2",
        "apis":[  
          {  
            "path":"/rest/v2/clients",
            "operations":[  
              {  
                "method":"GET",
                "nickname":"getCustomers",
                "responseClass":"api_clients",
                "parameters":[  
                  {  
                    "name":"firstResult",
                    "paramType":"query",
                    "description":"desc",
                    "dataType":"int",
                    "allowMultiple":false
                  },
                  {  
                    "name":"resultsPerPage",
                    "paramType":"query",
                    "description":"desc",
                    "dataType":"int",
                    "allowMultiple":false
                  }
                ],
                "summary":"The clients REST service end point returns a set of clients",
                "notes":"The clients REST service end point returns a set of clients",
                "errorResponses":[  
                  {  
                    "code":200,
                    "reason":"Clients found"
                  },
                  {  
                    "code":400,
                    "reason":"Invalid input, returns message body of Errors"
                  },
                  {  
                    "code":500,
                    "reason":"A database error has occurred"
                  }
                ],
                "produces":[  
                  "application/xml",
                  "application/json"
                ],
                "consumes":[  
                  "*/*",
                  "application/xml"
                ]
              }
        ]
      },
      "description":"",
      "path":"/rest"
    }
  ]
}
1

1 Answers

0
votes

The answer to your question, varies with your definition of "safe". My information is, that the documented APIs we be stable with the upcoming version 1.9 and will definitely be changed by the planned version 2.0.