com.ibm.broker.rest

Interface Api



  • public interface Api
    An interface that describes an API. An API has a host, port, and base path where that API is located, as well as a set of resources and operations that are available in that API.
    Since:
    IBM Integration Bus v10
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      Api addModel(Model model)
      Add a model to the API.
      Api addModel(java.lang.String name)
      Add a new model with blank Schema to the Api.
      Api addModel(java.lang.String name, com.ibm.broker.rest.schema.Schema schema)
      Add a new model with specified Schema to the Api.
      Resource addResource(Resource resource)
      Add an existing resource
      Resource addResource(java.lang.String path)
      Add a new resource with the specified path.
      Api deleteModel(Model model)
      Delete a model from the API.
      Api deleteModel(java.lang.String name)
      Delete a model from the API.
      Api deleteResource(java.lang.String path)
      Delete an existing resource with the specified path.
      java.lang.String getBasePath()
      Get the base path of this API, for example "/myapi/api".
      java.lang.String getBaseURL()
      Get the base URL of this API, for example "http://localhost/myapi/api".
      java.util.List<java.lang.String> getConsumesMIMETypes()
      Get a list of MIME types (for example application/json) that this API can consume.
      java.lang.String getDescription()
      Get the description of this API.
      java.util.List<DynamicContent> getDynamicContent()
      Get a list of dynamic content that can be served as supporting documentation for this API.
      java.lang.String getFileName()
      Get the name of the file that this API should be saved to.
      java.lang.String getHost()
      Get the host that serves this API, for example "localhost".
      java.lang.String getHost(boolean allowDefault)
      Get the host that serves this API, for example "localhost".
      Model getModel(java.lang.String name)
      Get the model with the specified name.
      java.util.Map<java.lang.String,java.util.List<com.ibm.broker.rest.schema.SchemaReference>> getModelReferences()
      Get the modelReferences map.
      java.util.List<Model> getModels()
      Get the list of models that are defined by this API.
      Operation getOperation(java.lang.String name)
      Get the specified operation provided by this API using its name.
      java.util.List<Operation> getOperations()
      Get the list of operations that are provided by this API.
      int getPort()
      Get the port that this API is served on, for example "443".
      java.util.List<java.lang.String> getProducesMIMETypes()
      Get a list of MIME types (for example application/json) that this API can produce.
      java.lang.String getProtocol()
      Get the protocol of this API, for example "https".
      ApiProvider getProvider()
      Get the API provider that created or loaded this API.
      Resource getResource(java.lang.String path)
      Get the resource with the specified path.
      java.util.List<Resource> getResources()
      Get the list of resources that are provided by this API.
      java.util.List<java.util.List<SecurityRequirement>> getSecurityRequirements()
      Get a list of security requirements for this API.
      SecurityScheme getSecurityScheme(java.lang.String name)
      Get the security scheme with the specified name from this API.
      java.util.List<SecurityScheme> getSecuritySchemes()
      Get the list of security schemes that have been defined in this API.
      java.util.List<StaticContent> getStaticContent()
      Get a list of static content that can be served as supporting documentation for this API.
      java.lang.String getTitle()
      Get the title of this API.
      java.lang.String getVersion()
      Get the version of this API, for example "1.0.0".
      void save(java.nio.file.Path file)
      Save the API definitions to the specified file.
      void saveToZip(java.util.zip.ZipOutputStream zos, java.lang.String fileName)
      Save the API definitions as new entries to the specified ZIP output stream.
      Api setBasePath(java.lang.String basePath)
      Set the base path of this API, for example "/myapi/api"/
      Api setBaseURL(java.lang.String baseURL)
      Set the base URL of this API, for example "http://localhost/myapi/api".
      Api setConsumesMIMETypes(java.util.List<java.lang.String> consumes)
      Set the list of MIME types (for example application/json) that this API can consume.
      Api setDescription(java.lang.String description)
      Set the description of this API.
      Api setFileName(java.lang.String fileName)
      Set the name of the file that this API should be saved to.
      Api setHost(java.lang.String host)
      Set the host that serves this API, for example "localhost".
      Api setPort(int port)
      Get the port that this API is served on, for example "443".
      Api setProducesMIMETypes(java.util.List<java.lang.String> produces)
      Set the list of MIME types (for example application/json) that this API can produce.
      Api setProtocol(java.lang.String protocol)
      Set the protocol of this API, for example "https".
      Api setTitle(java.lang.String title)
      Set the title of this API.
      Api setVersion(java.lang.String version)
      Set the version of this API, for example "1.0.0".
      java.lang.String toString()
      Convert this API into a string.
      java.lang.String toString(java.lang.String fileName)
      Convert this API into a string.
    • Method Detail

      • getProvider

        ApiProvider getProvider()
        Get the API provider that created or loaded this API.
        Returns:
        the API provider that created or loaded this API.
      • getFileName

        java.lang.String getFileName()
        Get the name of the file that this API should be saved to.
        Returns:
        the name of the file that this API should be saved to.
      • setFileName

        Api setFileName(java.lang.String fileName)
                 throws ApiException
        Set the name of the file that this API should be saved to.
        Returns:
        this API.
        Throws:
        ApiException - if the file name is not valid for use for this API.
      • getBaseURL

        java.lang.String getBaseURL()
        Get the base URL of this API, for example "http://localhost/myapi/api".
        Returns:
        the base URL of this API.
      • setBaseURL

        Api setBaseURL(java.lang.String baseURL)
                throws ApiException
        Set the base URL of this API, for example "http://localhost/myapi/api".
        Parameters:
        baseURL - the new base URL of this API.
        Returns:
        this API.
        Throws:
        ApiException - if the base URL could not be changed.
      • getProtocol

        java.lang.String getProtocol()
        Get the protocol of this API, for example "https".
        Returns:
        the protocol of this API.
      • setProtocol

        Api setProtocol(java.lang.String protocol)
                 throws ApiException
        Set the protocol of this API, for example "https".
        Parameters:
        protocol - the new protocol of this API.
        Returns:
        this API.
        Throws:
        ApiException - if the protocol could not be changed.
      • getHost

        java.lang.String getHost()
        Get the host that serves this API, for example "localhost".
        Returns:
        the host that serves this API.
      • getHost

        java.lang.String getHost(boolean allowDefault)
        Get the host that serves this API, for example "localhost".
        Parameters:
        allowDefault - if set to false, and the host is not set, then return null.
        Returns:
        the host that serves this API.
      • setHost

        Api setHost(java.lang.String host)
             throws ApiException
        Set the host that serves this API, for example "localhost".
        Parameters:
        host - the new host of this API.
        Returns:
        this API.
        Throws:
        ApiException - if the host could not be changed.
      • getPort

        int getPort()
        Get the port that this API is served on, for example "443".
        Returns:
        the port that this API is served on.
      • setPort

        Api setPort(int port)
             throws ApiException
        Get the port that this API is served on, for example "443".
        Parameters:
        port - the new port of this API.
        Returns:
        this API.
        Throws:
        ApiException - if the port could not be changed.
      • getBasePath

        java.lang.String getBasePath()
        Get the base path of this API, for example "/myapi/api".
        Returns:
        the base path of this API.
      • setBasePath

        Api setBasePath(java.lang.String basePath)
                 throws ApiException
        Set the base path of this API, for example "/myapi/api"/
        Parameters:
        basePath - the new base path of this API.
        Returns:
        this API.
        Throws:
        ApiException - if the base path could not be changed.
      • getTitle

        java.lang.String getTitle()
        Get the title of this API.
        Returns:
        the title of this API.
      • setTitle

        Api setTitle(java.lang.String title)
              throws ApiException
        Set the title of this API.
        Parameters:
        title - the new title of this API.
        Returns:
        this API.
        Throws:
        ApiException - if the title could not be changed.
      • getDescription

        java.lang.String getDescription()
        Get the description of this API.
        Returns:
        the description of this API.
      • setDescription

        Api setDescription(java.lang.String description)
                    throws ApiException
        Set the description of this API.
        Parameters:
        description - the new description of this API.
        Returns:
        this API.
        Throws:
        ApiException - if the description could not be changed.
      • getVersion

        java.lang.String getVersion()
        Get the version of this API, for example "1.0.0".
        Returns:
        the version of this API.
      • setVersion

        Api setVersion(java.lang.String version)
                throws ApiException
        Set the version of this API, for example "1.0.0".
        Parameters:
        version - the new version of this API.
        Returns:
        this API.
        Throws:
        ApiException - if the version could not be changed.
      • getModels

        java.util.List<Model> getModels()
        Get the list of models that are defined by this API.
        Returns:
        the list of models that are defined by this API.
      • getModel

        Model getModel(java.lang.String name)
                throws ApiException
        Get the model with the specified name.
        Parameters:
        name - the name of the model.
        Returns:
        the model with the specified name.
        Throws:
        ApiException - if no model with the specified name exists.
      • addModel

        Api addModel(java.lang.String name,
                     com.ibm.broker.rest.schema.Schema schema)
              throws ApiException
        Add a new model with specified Schema to the Api.
        Parameters:
        name - the desired name of the new model.
        schema - the desired Schema of the new model.
        Returns:
        the Api itself.
        Throws:
        ApiException
      • addModel

        Api addModel(java.lang.String name)
              throws ApiException
        Add a new model with blank Schema to the Api.
        Parameters:
        name - the desired name of the new model.
        Returns:
        the Api itself.
        Throws:
        ApiException
      • addModel

        Api addModel(Model model)
              throws ApiException
        Add a model to the API.
        Parameters:
        model - the model to add.
        Returns:
        the Api itself.
        Throws:
        ApiException
      • deleteModel

        Api deleteModel(java.lang.String name)
                 throws ApiException
        Delete a model from the API.
        Parameters:
        name - the name of the model to delete.
        Returns:
        the Api itself.
        Throws:
        ApiException
      • deleteModel

        Api deleteModel(Model model)
                 throws ApiException
        Delete a model from the API.
        Parameters:
        model - the model to delete.
        Returns:
        the Api itself
        Throws:
        ApiException
      • getResources

        java.util.List<Resource> getResources()
        Get the list of resources that are provided by this API.
        Returns:
        the list of resources that are provided by this API.
      • getResource

        Resource getResource(java.lang.String path)
                      throws ApiException
        Get the resource with the specified path.
        Parameters:
        path - the path of the resource.
        Returns:
        the resource with the specified path.
        Throws:
        ApiException - if no resource with the specified path exists.
      • addResource

        Resource addResource(java.lang.String path)
                      throws ApiException
        Add a new resource with the specified path.
        Parameters:
        path - the path of the resource.
        Returns:
        the new resource.
        Throws:
        ApiException - if the new resource could not be added.
      • addResource

        Resource addResource(Resource resource)
                      throws ApiException
        Add an existing resource
        Parameters:
        resource - - the resource.
        Returns:
        the resource.
        Throws:
        ApiException - if the resource could not be added.
      • deleteResource

        Api deleteResource(java.lang.String path)
                    throws ApiException
        Delete an existing resource with the specified path.
        Parameters:
        path - the path of the resource.
        Returns:
        this API.
        Throws:
        ApiException - if the existing resource could not be deleted.
      • getOperations

        java.util.List<Operation> getOperations()
        Get the list of operations that are provided by this API.
        Returns:
        the list of operations that are provided by this API.
      • getOperation

        Operation getOperation(java.lang.String name)
                        throws ApiException
        Get the specified operation provided by this API using its name.
        Parameters:
        name - the name of the operation.
        Returns:
        the specified operation.
        Throws:
        ApiException - if the specified operation does not exist.
      • toString

        java.lang.String toString()
        Convert this API into a string. The returned value is implementation specific.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the API converted into a string.
      • toString

        java.lang.String toString(java.lang.String fileName)
                           throws ApiException
        Convert this API into a string. The returned value is implementation specific.
        Parameters:
        fileName - specify a file name that the returned string should be suitable for saving to.
        Returns:
        the API converted into a string.
        Throws:
        ApiException - if the API cannot be converted into a string suitable for saving to the specified file name.
      • save

        void save(java.nio.file.Path file)
           throws ApiException
        Save the API definitions to the specified file. Other files may also be created by this operation.
        Parameters:
        file - the file to save the API definitions to.
        Throws:
        ApiException - if an error occurs saving the API definitions.
      • saveToZip

        void saveToZip(java.util.zip.ZipOutputStream zos,
                       java.lang.String fileName)
                throws ApiException
        Save the API definitions as new entries to the specified ZIP output stream. Multiple files may be created in the ZIP output stream by this operation.
        Parameters:
        zos - the ZIP output stream to save the API definitions to.
        fileName - the file to save the API definitions to in the ZIP output stream.
        Throws:
        ApiException - if an error occurs saving the API definitions.
      • getModelReferences

        java.util.Map<java.lang.String,java.util.List<com.ibm.broker.rest.schema.SchemaReference>> getModelReferences()
                                                                                                               throws ApiException
        Get the modelReferences map.
        Returns:
        A map containing the names of models and the SchemaReference objects that reference them.
        Throws:
        ApiException
      • getStaticContent

        java.util.List<StaticContent> getStaticContent()
                                                throws ApiException
        Get a list of static content that can be served as supporting documentation for this API.
        Returns:
        a list of static content that can be served as supporting documentation for this API.
        Throws:
        ApiException
      • getDynamicContent

        java.util.List<DynamicContent> getDynamicContent()
                                                  throws ApiException
        Get a list of dynamic content that can be served as supporting documentation for this API.
        Returns:
        a list of dynamic content that can be served as supporting documentation for this API.
        Throws:
        ApiException
      • getConsumesMIMETypes

        java.util.List<java.lang.String> getConsumesMIMETypes()
        Get a list of MIME types (for example application/json) that this API can consume.
        Returns:
        a list of MIME types that that this API can consume, or null if not specified.
      • setConsumesMIMETypes

        Api setConsumesMIMETypes(java.util.List<java.lang.String> consumes)
                          throws ApiException
        Set the list of MIME types (for example application/json) that this API can consume.
        Parameters:
        consumes - the list of MIME types that this API can consume, or null to clear the list.
        Returns:
        this API.
        Throws:
        ApiException - if the list could not be set.
      • getProducesMIMETypes

        java.util.List<java.lang.String> getProducesMIMETypes()
        Get a list of MIME types (for example application/json) that this API can produce.
        Returns:
        a list of MIME types that that this API can consume, or null if not specified.
      • setProducesMIMETypes

        Api setProducesMIMETypes(java.util.List<java.lang.String> produces)
                          throws ApiException
        Set the list of MIME types (for example application/json) that this API can produce.
        Parameters:
        produces - the list of MIME types that this API can produce, or null to clear the list.
        Returns:
        this API.
        Throws:
        ApiException - if the list could not be set.
      • getSecuritySchemes

        java.util.List<SecurityScheme> getSecuritySchemes()
        Get the list of security schemes that have been defined in this API.
        Returns:
        a list of security schemes that have been defined in this API.
      • getSecurityScheme

        SecurityScheme getSecurityScheme(java.lang.String name)
                                  throws ApiException
        Get the security scheme with the specified name from this API.
        Parameters:
        name - the name of the security scheme.
        Returns:
        the security scheme.
        Throws:
        ApiException - if no security scheme exists with the specified name.
      • getSecurityRequirements

        java.util.List<java.util.List<SecurityRequirement>> getSecurityRequirements()
        Get a list of security requirements for this API. The returned object is a list containing a set of alternative security requirement options. You only need to satisfy the security requirements for one security requirement option in that set. Each security requirement option is itself a list, containing a set of security requirements that must all be satisfied in order to satisfy the security requirement option.
        Returns:
        a list of security requirements for this API.