Overview

This page shows the usage of the Module API, please see the following for more details.

Documents & examples

Method: GET

URL: /rest_api/v1/modules/

Query Params:

  • active (bool)
  • build_dep_name (string)
  • build_dep_stream (string)
  • component_branch (string)
  • component_name (string)
  • context (string, case insensitive)
  • koji_tag (string, case insensitive)
  • name (string, case insensitive)
  • rpm_filename (string)
  • runtime_dep_name (string)
  • runtime_dep_stream (string)
  • stream (string, case insensitive)
  • uid (string, case insensitive)
  • version (string, case insensitive)
  • ordering (string) Comma separated list of fields for ordering results.
    • To sort by a field in descending order, prefix its name with minus (e.g. -name).
    • Use double underscores for nested field names (e.g. parent__child for {"parent": {"child": ...}}).

Following filters can be used to show only specific fields. This can make response time faster. Format is list or single value (JSON: {"fields": ["a","b"]} or {"fields": "a"}, in URL: ?fields=a&fields=b).

  • fields (list | string) Fields to display (other fields will be hidden).
  • exclude_fields: (list | string) Fields NOT to display (overrules fields).

Paged Response:

{
    "active (optional, default=false)": "boolean", 
    "build_deps (optional, default=null)": [
        {
            "dependency": "string", 
            "stream": "string"
        }
    ], 
    "context": "string", 
    "koji_tag": "string", 
    "modulemd": "string", 
    "name": "string", 
    "rpms (optional, default=null)": [
        "string"
    ], 
    "runtime_deps (optional, default=null)": [
        {
            "dependency": "string", 
            "stream": "string"
        }
    ], 
    "stream": "string", 
    "uid (read-only)": "string", 
    "version": "string"
}

Method: GET

URL: /rest_api/v1/modules/{uid}/

Response:

{
    "active (optional, default=false)": "boolean", 
    "build_deps (optional, default=null)": [
        {
            "dependency": "string", 
            "stream": "string"
        }
    ], 
    "context": "string", 
    "koji_tag": "string", 
    "modulemd": "string", 
    "name": "string", 
    "rpms (optional, default=null)": [
        "string"
    ], 
    "runtime_deps (optional, default=null)": [
        {
            "dependency": "string", 
            "stream": "string"
        }
    ], 
    "stream": "string", 
    "uid (read-only)": "string", 
    "version": "string"
}

Method: POST

URL: /rest_api/v1/modules/

Data:

{
    "active (optional, default=false)": "boolean", 
    "build_deps (optional, default=null)": [
        {
            "dependency": "string", 
            "stream": "string"
        }
    ], 
    "context": "string", 
    "koji_tag": "string", 
    "modulemd": "string", 
    "name": "string", 
    "rpms (optional, default=null)": [
        {
            "arch": "string", 
            "epoch": "string", 
            "name": "string", 
            "release": "string", 
            "srpm_name": "string", 
            "version": "string"
        }
    ], 
    "runtime_deps (optional, default=null)": [
        {
            "dependency": "string", 
            "stream": "string"
        }
    ], 
    "stream": "string", 
    "version": "string"
}

Response:

{
    "active (optional, default=false)": "boolean", 
    "build_deps (optional, default=null)": [
        {
            "dependency": "string", 
            "stream": "string"
        }
    ], 
    "context": "string", 
    "koji_tag": "string", 
    "modulemd": "string", 
    "name": "string", 
    "rpms (optional, default=null)": [
        "string"
    ], 
    "runtime_deps (optional, default=null)": [
        {
            "dependency": "string", 
            "stream": "string"
        }
    ], 
    "stream": "string", 
    "uid (read-only)": "string", 
    "version": "string"
}

Example:

curl -X POST -H "Content-Type: application/json" https://pdc.fedoraproject.org/rest_api/v1/modules/ \
    -d '{ "name": "testmodule", "stream": "f28", "version": "20180123171544", "context": "2f345c78", "koji_tag": "module-ce2adf69caf0e1b5", "modulemd": "data here" }'

It is possible to create this resource in bulk. To do so, use the same procedure as when creating a single instance, only the request body should contain a list of JSON objects. The response you get back will also contain a list of values which you would obtain by submitting the request data separately.

Method: PUT/PATCH

URL: /rest_api/v1/modules/{uid}/

Data:

{
    "active (optional, default=false)": "boolean", 
    "build_deps (optional, default=null)": [
        {
            "dependency": "string", 
            "stream": "string"
        }
    ], 
    "context": "string", 
    "koji_tag": "string", 
    "modulemd": "string", 
    "name": "string", 
    "rpms (optional, default=null)": [
        {
            "arch": "string", 
            "epoch": "string", 
            "name": "string", 
            "release": "string", 
            "srpm_name": "string", 
            "version": "string"
        }
    ], 
    "runtime_deps (optional, default=null)": [
        {
            "dependency": "string", 
            "stream": "string"
        }
    ], 
    "stream": "string", 
    "version": "string"
}

Response:

{
    "active (optional, default=false)": "boolean", 
    "build_deps (optional, default=null)": [
        {
            "dependency": "string", 
            "stream": "string"
        }
    ], 
    "context": "string", 
    "koji_tag": "string", 
    "modulemd": "string", 
    "name": "string", 
    "rpms (optional, default=null)": [
        "string"
    ], 
    "runtime_deps (optional, default=null)": [
        {
            "dependency": "string", 
            "stream": "string"
        }
    ], 
    "stream": "string", 
    "uid (read-only)": "string", 
    "version": "string"
}

Example:

curl -X PATCH -d '{ "active": true }' -H "Content-Type: application/json" \
    https://pdc.fedoraproject.org/rest_api/v1/modules/uid_here/

Method: DELETE

URL: /rest_api/v1/modules/{uid}/

Response:

STATUS: 204 NO CONTENT

Example:

curl -X DELETE -H "Content-Type: application/json" https://pdc.fedoraproject.org/rest_api/v1/modules/uid_here/

It is possible to delete multiple items in one request. Use the DELETE method with the same url as for listing/creating objects. The request body should contain a list with identifiers for objects to be deleted. The identifier is usually the last part of the URL for deleting a single object.

It is possible to update multiple objects in one request. Use the PUT or PATCH method with the same url as for listing/creating objects. The request body should contain an object, where keys are identifiers of objects to be modified and their values use the same format as normal update.

Browsable GET

GET /rest_api/v1/modules/platform-f29-4/
HTTP 200 OK
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "uid": "platform-f29-4",
    "name": "platform",
    "stream": "f29",
    "version": "4",
    "context": "00000000",
    "active": true,
    "koji_tag": "module-f29-build",
    "modulemd": "data:\n  description: Fedora 29 traditional base\n  license:\n    module: [MIT]\n  name: platform\n  profiles:\n    buildroot:\n      rpms: [bash, bzip2, coreutils, cpio, diffutils, fedora-release, findutils, gawk,\n        gcc, gcc-c++, grep, gzip, info, make, patch, redhat-rpm-config, rpm-build,\n        sed, shadow-utils, tar, unzip, util-linux, which, xz]\n    srpm-buildroot:\n      rpms: [bash, fedora-release, fedpkg-minimal, gnupg2, redhat-rpm-config, rpm-build,\n        shadow-utils]\n  stream: f29\n  summary: Fedora 29 traditional base\n  context: 00000000\n  version: 4\n  xmd:\n    mbs:\n      buildrequires: {}\n      commit: virtual\n      requires: {}\ndocument: modulemd\nversion: 1",
    "runtime_deps": [],
    "build_deps": [],
    "rpms": []
}