How to use the DeployIt's namePattern parameter in the repository/query web-service

324 Views Asked by At

I’m trying to use the REST API provided by DeployIt (v3.9) to list all the packages available on a given project. Thus, I use the GET /repository/query service

So, I’m calling this service with the following URL:

http://[server]/deployit/repository/query?namePattern=my-app&type=udm.DeploymentPackage

Unfortunately, I don’t get anything (just an empty list).

If I remove the namePattern from my URL, then I get a long list of all applications (not only the only I'm interested in). So it appears that I don’t set correctly the namePattern attribute. In the documentation, they say:

a search pattern for the name. This is like the SQL "LIKE" pattern: the character '%' represents any string of zero or more characters, and the character '_' (underscore) represents any single character. Any literal use of these two characters must be escaped with a backslash ('\'). Consequently, any literal instance of a backslash must also be escaped, resulting in a double backslash ('\').

So I tried the following URL:

  • http://[server]/deployit/repository/query?type=udm.DeploymentPackage&namePattern=my-app : empty list
  • http://[server]/deployit/repository/query?type=udm.DeploymentPackage&namePattern=%my-app%: error 400
  • http://[server]/deployit/repository/query?type=udm.DeploymentPackage&namePattern=%25my-app%25 (trying to escape the % character): empty list
  • http://[server]/deployit/repository/query?type=udm.DeploymentPackage&namePattern=Applications/my-app/2.0.0 (with a real version): error, character ‘/’ not allowed.
  • http://[server]/deployit/repository/query?type=udm.DeploymentPackage&namePattern=2.0.0 : I get the list of all applications deployed with a version 2.0.0 (including my my-app), but that's not what I'm looking for (I want all versions available on DeployIt for my-app).

So, what is the correct URL to retrieve the list of deployed applications?

1

There are 1 best solutions below

0
On

I've solved my problem. In fact, the namePattern only applies to the last part of the Application name, i.e. the version. Thus, I have to use the parent attribute to retrieve the list of my application:

http://[server]/deployit/repository/query?type=udm.DeploymentPackage&parent=Applications%2Fmy-app&resultsPerPage=-1