Skip to content

Fetching template info by name

Dilshat edited this page May 23, 2018 · 25 revisions

Obtain template info by name ../info?name=master (Note: 1 template info at most must be returned by this endpoint or 404 Not found )

This REST has mandatory parameter name and optional parameters owner and token. So we have these combinations (if optional parameter is missing or empty or invalid then it must be considered missing):

  1. name (e.g /info?name=master)
  2. name + owner (e.g. /info?name=master&owner={owner})
  3. name + token (e.g. /info?name=master&token={token})
  4. name + owner + token (e.g. /info?name=master&owner={owner}&token={token})

Search is done this way:

  1. CDN searches template only within verified templates (owner Jenkins/Subutai)

  2. CDN searches template only within the specified owner's templates (specified owner's public templates)

  3. needs special treatment:

    a) if token is valid (not empty, not missing, and gets authed successfully) then CDN must use token's user as owner and search using template name and user as owner (thus it searches within the authed user's own templates or templates shared with him).
    If it does not find there then it searches within verified templates.
    If special flag verified=true provided then search is done only within verified templates regardless of token

    b) in case of invalid token it searches within verified templates

  4. the same as #2 (if token is valid then searches also among private templates of the specified owner that are shared with the token holder, if owner == token holder then searches among private templates of the token handler)

Note: if version parameter is passed, it is used to further filter the searched set by the supplied version.

Note about fetching templates by ID: When template is fetched by ID, it is searched within all public templates. If token is specified, then search is done within all accessible templates: all public templates + the token holder's private templates + templates shared with the token holder