Documentation for the Code

BioPortal main

BioPortal instance

Represents an abstract RESTful resource. Concrete resources should extend from this class and expose methods for each supported HTTP method. If a resource is invoked with an unsupported HTTP method, the API will return a response with status 405 Method Not Allowed. Otherwise the appropriate method is called and passed all arguments from the url rule used when adding the resource to an Api instance. See add_resource() for details.

resources.instance.Instance.delete(instance_id)

Delete specific instance

This function allows users to delete their instance specified by its ID.

Parameters

instance_id (openstack instance id) – id of the cloud instance

Returns

empty json and http status code

  • Example:

    curl -X DELETE bio-portal.metacentrum.cz/api/instances/instance_id/ -H 'Cookie: cookie from scope' -H 'content-type: application/json'
    
  • Expected Success Response:

    HTTP Status Code: 204
    
    {}
    
  • Expected Fail Response:

    HTTP Status Code: 400
    
    {}
    
resources.instance.Instance.get(instance_id=None)

Get specific instance

This function allows users to get their instance specified by its ID. If no parameter given, all users instances are returned

Parameters

instance_id (openstack instance id or None) – id of the cloud instance

Returns

instance/s information in json and http status code

  • Example:

    curl -X GET bio-portal.metacentrum.cz/api/instances/_your_instance_id/
     -H 'Cookie: cookie from scope' -H 'content-type: application/json'
    
  • Expected Success Response:

    HTTP Status Code: 200
    
    json-format: see openstack.compute.v2.server
    
    or
    
    HTTP Status Code: 200
    
    openstack.compute.v2.server array
    
  • Expected Fail Response:

    HTTP Status Code: 404
    
    {}
    
resources.instance.Instance.post()

Create new instance

This function allows users to start new instance.

Its json input is specified by schema.StartServerSchema

Returns

instance information in json and http status code

  • Example:

    curl -X POST bio-portal.metacentrum.cz/api/instances/ -H 'Cookie: cookie from scope' -H
    'content-type: application/json' --data json specified in schema
    
  • Expected Success Response:

    HTTP Status Code: 201
    
    json-format: see openstack.compute.v2.server
    
  • Expected Fail Response:

    HTTP Status Code: 400
    
    {"message": "resoucre not found"}
    

BioPortal keypair

Represents an abstract RESTful resource. Concrete resources should extend from this class and expose methods for each supported HTTP method. If a resource is invoked with an unsupported HTTP method, the API will return a response with status 405 Method Not Allowed. Otherwise the appropriate method is called and passed all arguments from the url rule used when adding the resource to an Api instance. See add_resource() for details.

resources.keypair.Keypair.post()

Add new public key

This function allows users to add new public key. If keypair with given name doesnt exist, its created. In case keypair with same name exits and their keys are different, old key is deleted and new one is created. Otherwise returns keypair that already existed is returned

Its json input is specified by CreateKeypairSchema

Returns

keypair information in json and http status code

  • Example:

    curl -X POST bio-portal.metacentrum.cz/api/keypairs/ -H 'Cookie: cookie from scope' -H
    'content-type: application/json' --data json specified in schema
    
  • Expected Success Response:

    HTTP Status Code: 200
    
    json-format: see openstack.compute.v2.keypair.Keypair
    
    or
    
    HTTP Status Code: 201
    
    json-format: see openstack.compute.v2.keypair.Keypair
    
  • Expected Fail Response:

    HTTP Status Code: 400
    
    {}
    

BioPortal gateway

Represents an abstract RESTful resource. Concrete resources should extend from this class and expose methods for each supported HTTP method. If a resource is invoked with an unsupported HTTP method, the API will return a response with status 405 Method Not Allowed. Otherwise the appropriate method is called and passed all arguments from the url rule used when adding the resource to an Api instance. See add_resource() for details.

resources.gateway.Gateway.put(router_id)

Update gateway

This function allows users to add external gateway. Its json input is specified by schema.NetworkSchema

Parameters

instance_id (openstack instance id or None) – id of the cloud instance

Returns

router information in json and http status code

  • Example:

    curl -X PUT bio-portal.metacentrum.cz/api/gateways/ -H 'Cookie: cookie from scope' -H
    'content-type: application/json' --data json specified in schema
    
  • Expected Success Response:

    HTTP Status Code: 200
    
    json-format: see openstack.network.v2.router
    
  • Expected Fail Response:

    HTTP Status Code: 400
    
    {"message": "Wrong router ID, router not found!"}
    

BioPortal limit

Represents an abstract RESTful resource. Concrete resources should extend from this class and expose methods for each supported HTTP method. If a resource is invoked with an unsupported HTTP method, the API will return a response with status 405 Method Not Allowed. Otherwise the appropriate method is called and passed all arguments from the url rule used when adding the resource to an Api instance. See add_resource() for details.

resources.limit.Limit.get()

Get resource limits

This function allows users to get their resource limits and their usage.

Returns

limit information in json and http status code

  • Example:

    curl -X GET bio-portal.metacentrum.cz/api/limits/ -H 'Cookie: cookie from scope'
    -H 'content-type: application/json'
    
  • Expected Success Response:

    HTTP Status Code: 200
    
    {"floating_ips":
        {"limit": 5,
         "used" : 2},
    "instances":
        {"limit": 3,
         "used" : 1},
    "cores":
        {"limit": 16,
         "used" : 6},
    "ram":
        {"limit": 4,
         "used" : 1},
    }
    
  • Expected Fail Response:

    HTTP Status Code: 400
    
    {}
    

BioPortal login

Represents an abstract RESTful resource. Concrete resources should extend from this class and expose methods for each supported HTTP method. If a resource is invoked with an unsupported HTTP method, the API will return a response with status 405 Method Not Allowed. Otherwise the appropriate method is called and passed all arguments from the url rule used when adding the resource to an Api instance. See add_resource() for details.

resources.login.Login.get()

Verify your login

This function allows users to verify their login.

Returns

json and http status code

  • Example:

    curl -X GET bio-portal.metacentrum.cz/api/ -H 'Cookie: cookie returned by scope'
    
  • Expected Success Response:

    HTTP Status Code: 200
    
    {"project_id": project_id, "token": token}
    
  • Expected Fail Response:

    HTTP Status Code: 401
    
    {'message': reason}
    
resources.login.Login.post()

Login to portal

This function allows users to login to portal using their token.

Returns

empty json and http status code

  • Example:

    curl -v POST bio-portal.metacentrum.cz/api/
    -H 'content-type: application/json' --data '{"token": your_token}'
    
  • Expected Success Response:

    HTTP Status Code: 200
    
    {}
    
resources.login.Login.put()

Scope to project

This function allows users to scope to their chosen project. Its json input is specified by ScopeSchema

Returns

{} and http status code

  • Example:

    curl -X PUT bio-portal.metacentrum.cz/api/ -H 'Cookie: cookie returned by login'
     -H 'content-type: application/json' --data '{"project_id": project_id}'
    
  • Expected Success Response:

    HTTP Status Code: 204
    
    {}
    
  • Expected Fail Response:

    HTTP Status Code: 401
    
    {'message': 'unauthorized'}
    

BioPortal metadata

Represents an abstract RESTful resource. Concrete resources should extend from this class and expose methods for each supported HTTP method. If a resource is invoked with an unsupported HTTP method, the API will return a response with status 405 Method Not Allowed. Otherwise the appropriate method is called and passed all arguments from the url rule used when adding the resource to an Api instance. See add_resource() for details.

resources.metadata.Metadata.delete(instance_id)

Get instance metadata

This function allows users to remove instance metadata. Its json input is specified by schema.DeleteMetadataSchema

Parameters

instance_id (openstack instance) – id of the cloud instance

Returns

empty json and http status code

  • Example:

    curl -X DELETE bio-portal.metacentrum.cz/api/metadata/instance_id/ -H 'Cookie: cookie from scope'
    'content-type: application/json' --data json specified in schema
    
  • Expected Success Response:

    HTTP Status Code: 204
    
    {}
    
  • Expected Fail Response:

    HTTP Status Code: 400
    
    {"message": "instance not found"}
    
    or
    
    HTTP Status Code: 400
    
    {"message": "key not in metadata"}
    
resources.metadata.Metadata.put(instance_id)

Update instance metadata

This function allows users to add/update instance metadata. Its json input is specified by schema.CreateMetadataSchema

Parameters

instance_id (openstack instance id) – id of the cloud instance

Returns

instance information in json and http status code

  • Example:

    curl -X PUT bio-portal.metacentrum.cz/api/metadata/instance_id/ -H 'Cookie: cookie from scope' -H
    'content-type: application/json' --data json specified in schema
    
  • Expected Success Response:

    HTTP Status Code: ??
    
    json-format: see openstack.compute.v2.server.Server
    
  • Expected Fail Response:

    HTTP Status Code: 400
    
    {"message": "instance not found"}
    

BioPortal network

Represents an abstract RESTful resource. Concrete resources should extend from this class and expose methods for each supported HTTP method. If a resource is invoked with an unsupported HTTP method, the API will return a response with status 405 Method Not Allowed. Otherwise the appropriate method is called and passed all arguments from the url rule used when adding the resource to an Api instance. See add_resource() for details.

resources.network.Network.get(network_id=None)

Get/list network

This function allows users to get their network specified by its ID. If no parameter given, all users networks are returned

Parameters

network_id (openstack network id or None) – id of the network

Returns

network/s in json and http status code

  • Example:

    curl -X GET bio-portal.metacentrum.cz/api/networks/_your_keypair_id/ -H 'Cookie: cookie from scope'
    -H 'content-type: application/json'
    
  • Expected Success Response:

    HTTP Status Code: 200
    
    json-format: see openstack.network.v2.network.Network
    
    or
    
    HTTP Status Code: 200
    
    openstack.network.v2..network.Network array
    
  • Expected Fail Response:

    HTTP Status Code: 404
    
    {}
    

BioPortal project

Represents an abstract RESTful resource. Concrete resources should extend from this class and expose methods for each supported HTTP method. If a resource is invoked with an unsupported HTTP method, the API will return a response with status 405 Method Not Allowed. Otherwise the appropriate method is called and passed all arguments from the url rule used when adding the resource to an Api instance. See add_resource() for details.

resources.project.Project.get()

Get your projects

This function allows users to list all their projects.

Returns

all users projects in json and http status code

  • Example:

    curl -X GET bio-portal.metacentrum.cz/api/projects/ -H 'Cookie: login cookie'
    
  • Expected Success Response:

    HTTP Status Code: 200
    
    {'links':   {'next': None,
                'previous': None,
                'self': 'https://identity.cloud.muni.cz/v3/users/$user_id/projects'},
                'projects':  [{'description': 'project description',
                                'domain_id': 'domain id',
                                'enabled': True,
                                'id': 'project id',
                                'is_domain': False,
                                'links': {'self': 'link to the project'},
                                'name': 'project name',
                                'options': {},
                                'parent_id': 'parent id',
                                'tags': ['tag']}
    

BioPortal router

Represents an abstract RESTful resource. Concrete resources should extend from this class and expose methods for each supported HTTP method. If a resource is invoked with an unsupported HTTP method, the API will return a response with status 405 Method Not Allowed. Otherwise the appropriate method is called and passed all arguments from the url rule used when adding the resource to an Api instance. See add_resource() for details.

resources.router.Router.get(router_id=None)

Get router

This function allows users to get their router specified by its ID (not implemented). If no parameter given, all users routers are returned

Parameters

router_id (openstack router id or None) – id of the cloud router

Returns

router/s information in json and http status code

  • Example:

    curl -X GET http://bio-portal.metacentrum.cz/api/routers/ -H 'Cookie: cookie from scope'
    
  • Expected Success Response:

    HTTP Status Code: 200
    
    openstack.network.v2.router array
    
  • Expected Fail Response:

    HTTP Status Code: 404
    
    {}
    
    or
    
    HTTP Status Code: 501
    
    {}
    

BioPortal security_group

Represents an abstract RESTful resource. Concrete resources should extend from this class and expose methods for each supported HTTP method. If a resource is invoked with an unsupported HTTP method, the API will return a response with status 405 Method Not Allowed. Otherwise the appropriate method is called and passed all arguments from the url rule used when adding the resource to an Api instance. See add_resource() for details.

resources.security_group.SecurityGroup.get(security_group_id=None)

Get/list security group/s

This function allows users to get their security group specified by its ID. If no parameter given, all users security groups are returned

Parameters

security_group_id (openstack security group id or None) – id of the security group

Returns

security group/s information in json and http status code

  • Example:

    curl -X GET bio-portal.metacentrum.cz/api/security_group/_your_sgroup_id/ -H 'Cookie: cookie from scope'
     -H 'content-type: application/json'
    
  • Expected Success Response:

    HTTP Status Code: 200
    
    json-format: see openstack.network.v2.security_group
    
    or
    
    HTTP Status Code: 200
    
    openstack.network.v2.security_group array
    
  • Expected Fail Response:

    HTTP Status Code: 404
    
    {}
    
resources.security_group.SecurityGroup.post()

Create new security group

This function allows users to create new security group.

Its json input is specified by schema.SecurityGroupSchema

Returns

security group information in json and http status code

  • Example:

    curl -X POST bio-portal.metacentrum.cz/api/security_groups/ -H 'Cookie: cookie from scope' -H
    'content-type: application/json' --data json specified in schema
    
  • Expected Success Response:

    HTTP Status Code: 201
    
    json-format: see openstack.compute.v2.server
    
  • Expected Fail Response:

    HTTP Status Code: 400
    
    {"message": ...}
    

BioPortal security_group_rule

Represents an abstract RESTful resource. Concrete resources should extend from this class and expose methods for each supported HTTP method. If a resource is invoked with an unsupported HTTP method, the API will return a response with status 405 Method Not Allowed. Otherwise the appropriate method is called and passed all arguments from the url rule used when adding the resource to an Api instance. See add_resource() for details.

resources.security_group_rule.SecurityGroupRule.post(security_group_id)

Add security group rule

This function allows users to add new security group rule.

Its json input is specified by schema.SecurityGroupRuleSchema

Parameters

security_group_id (openstack security group id) – id of the security group id

Returns

information about created rule in json and http status code

  • Example:

    curl -X POST bio-portal.metacentrum.cz/api/security_groups/security_group_id/security_group_rule/
    -H 'Cookie: cookie from scope' -H 'content-type: application/json' --data json_specified_in_schema
    
  • Expected Success Response:

    HTTP Status Code: 201
    
    json-format: see openstack.network.v2.security_group_rule
    
  • Expected Fail Response:

    HTTP Status Code: 409
    {"message": ...}
    

BioPortal floating_ip

Represents an abstract RESTful resource. Concrete resources should extend from this class and expose methods for each supported HTTP method. If a resource is invoked with an unsupported HTTP method, the API will return a response with status 405 Method Not Allowed. Otherwise the appropriate method is called and passed all arguments from the url rule used when adding the resource to an Api instance. See add_resource() for details.

resources.floating_ip.FloatingIp.get(floating_ip_id=None)

Get specific Floating IP

This function allows users to get their Floating IP specified by its ID. If no parameter given, all users FIPs are returned

Parameters

floating_ip_id (openstack FIP id or None) – id of the floating ip

Returns

FIP/s information in json and http status code

  • Example:

    curl -X GET bio-portal.metacentrum.cz/api/floating_ips/_your_floating_ip/ -H
    'Cookie: cookie from scope' -H 'content-type: application/json'
    
  • Expected Success Response:

    HTTP Status Code: 200
    
    json-format: see openstack.network.v2.floating_ip
    
    or
    
    HTTP Status Code: 200
    
    openstack.network.v2.floating_ip array
    
  • Expected Fail Response:

    HTTP Status Code: 404
    
    {}
    
resources.floating_ip.FloatingIp.post()

Create new Floating IP

This function allows users to add new Floating IP to specified instance. If FIP doesnt exist, its created. If already exists and is not attached, then it will be attached to instance

Its correct json input is specified by schema.FloatingIpSchema

Returns

floating information in json and http status code

  • Example:

    curl -X GET bio-portal.metacentrum.cz/api/floating_ips/ -H 'Cookie: cookie from scope' -H
    'content-type: application/json' --data: json specified in schema
    
  • Expected Success Response:

    HTTP Status Code: 200
    
    json-format: see openstack.network.v2.floating_ip
    
    or
    
    HTTP Status Code: 201
    
    json-format: see openstack.network.v2.floating_ip
    
  • Expected Fail Response:

    HTTP Status Code: 400
    
    {"message": "Server not found"}
    
    or
    
    HTTP Status Code: 400
    
    {"message": "Network not found"}
    

BioPortal image

Represents an abstract RESTful resource. Concrete resources should extend from this class and expose methods for each supported HTTP method. If a resource is invoked with an unsupported HTTP method, the API will return a response with status 405 Method Not Allowed. Otherwise the appropriate method is called and passed all arguments from the url rule used when adding the resource to an Api instance. See add_resource() for details.

resources.image.Image.get(image_id=None)

Get specific image

This function allows users to get their image specified by its ID. If no parameter given, all available images are returned

Parameters

image_id (openstack image id or None) – id of the image

Returns

image information in json and http status code

  • Example:

    curl -X GET bio-portal.metacentrum.cz/api/images/_your_image_id/ -H
    'Cookie: cookie from scope' -H 'content-type: application/json'
    
  • Expected Success Response:

    HTTP Status Code: 200
    
    json-format: see openstack.compute.v2.image
    
    or
    
    HTTP Status Code: 200
    
    openstack.compute.v2.image array
    
  • Expected Fail Response:

    HTTP Status Code: 404
    
    {}