Class APIPublisherRestClient


  • public class APIPublisherRestClient
    extends Object
    • Constructor Detail

      • APIPublisherRestClient

        public APIPublisherRestClient​(String backendURL)
        construct of API rest client
        Parameters:
        backendURL - - backend URL of the publisher Jaggery app
    • Method Detail

      • copyAPI

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse copyAPI​(String provider,
                                                                                      String apiName,
                                                                                      String oldVersion,
                                                                                      String newVersion,
                                                                                      String isDefaultVersion)
                                                                               throws APIManagerIntegrationTestException
        copy API from existing API
        Parameters:
        provider - - name of the provider , ex: admin
        apiName - - API name
        oldVersion - - existing version
        newVersion - - new version
        isDefaultVersion - - check default version
        Returns:
        - http response object
        Throws:
        APIManagerIntegrationTestException - - Throws if error occurred at API copy operation
      • updateAPI

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse updateAPI​(APIRequest apiRequest)
                                                                                 throws Exception
        Facilitate update API
        Parameters:
        apiRequest - - constructed API request object
        Returns:
        http response object
        Throws:
        APIManagerIntegrationTestException - - throws if update API fails
        Exception
      • removeDocumentation

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse removeDocumentation​(String apiName,
                                                                                                  String version,
                                                                                                  String provider,
                                                                                                  String docName,
                                                                                                  String docType)
                                                                                           throws APIManagerIntegrationTestException
        Remove document
        Parameters:
        apiName - - API name
        version - - API version
        provider - - name of the provider
        docName - - document name
        docType - - document type
        Returns:
        http response object
        Throws:
        APIManagerIntegrationTestException - - Throws if remove API document fails
      • revokeAccessToken

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse revokeAccessToken​(String accessToken,
                                                                                                String consumerKey,
                                                                                                String authUser)
                                                                                         throws APIManagerIntegrationTestException
        revoke access token
        Parameters:
        accessToken - - access token already received
        consumerKey - - consumer key returned
        authUser - - user name
        Returns:
        http response object
        Throws:
        APIManagerIntegrationTestException - - throws if access token revoke fails
      • updatePermissions

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse updatePermissions​(String tierName,
                                                                                                String permissionType,
                                                                                                String roles)
                                                                                         throws APIManagerIntegrationTestException
        update permissions to API access
        Parameters:
        tierName - - name of api throttling tier
        permissionType - - permission type
        roles - - roles of permission
        Returns:
        http response object
        Throws:
        APIManagerIntegrationTestException - - throws if permission update fails
      • updateResourceOfAPI

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse updateResourceOfAPI​(String provider,
                                                                                                  String apiName,
                                                                                                  String version,
                                                                                                  String swaggerRes)
                                                                                           throws APIManagerIntegrationTestException
        Update resources of API
        Parameters:
        provider - - provider name of creator
        apiName - - name of api
        version - - api version
        swaggerRes - - swagger doc
        Returns:
        http response object
        Throws:
        APIManagerIntegrationTestException - - throws if API resource update fails
      • getAPI

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getAPI​(String apiName,
                                                                                     String provider,
                                                                                     String version)
                                                                              throws APIManagerIntegrationTestException
        Get the API information for the given API Name, API Version and API Provider
        Parameters:
        apiName - Name of the API
        provider - Provider Name of the API
        version - Version of the API
        Returns:
        http response object
        Throws:
        APIManagerIntegrationTestException - - Unable to get API information
      • checkValidEndpoint

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse checkValidEndpoint​(String type,
                                                                                                 String endpointUrl,
                                                                                                 String providerName,
                                                                                                 String apiName,
                                                                                                 String apiVersion)
                                                                                          throws APIManagerIntegrationTestException
        Check whether the Endpoint is valid
        Parameters:
        endpointUrl - url of the endpoint
        type - type of Endpoint
        Returns:
        HttpResponse - Response of the getAPI request
        Throws:
        APIManagerIntegrationTestException - - Check for valid endpoint fails.
      • changeAPILifeCycleStatusToPublish

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse changeAPILifeCycleStatusToPublish​(org.wso2.carbon.apimgt.api.model.APIIdentifier apiIdentifier,
                                                                                                                boolean isRequireReSubscription)
                                                                                                         throws APIManagerIntegrationTestException
        Change the API Lifecycle status to Publish with the option of Re-subscription is required or not
        Parameters:
        apiIdentifier - - Instance of APIIdentifier
        isRequireReSubscription - - true if Re-subscription is required else false.
        Returns:
        HttpResponse - Response of the API publish event
        Throws:
        APIManagerIntegrationTestException - - Exception Throws in checkAuthentication() and when do the REST service calls to do the lifecycle change.
      • getApi

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getApi​(String apiName,
                                                                                     String provider,
                                                                                     String version)
                                                                              throws APIManagerIntegrationTestException
        Get the API information for the given API Name,API Version and API Provider
        Parameters:
        apiName - - Name of the API
        provider - - Provider Name of the API
        version - - Version of the API
        Returns:
        HttpResponse - Response of the getAPI request
        Throws:
        APIManagerIntegrationTestException - - Exception Throws in checkAuthentication() and when do the REST service calls to get the API information.
      • getTierPermissionsPage

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getTierPermissionsPage()
                                                                                              throws APIManagerIntegrationTestException
        Retrieve the Tier Permission Page
        Returns:
        HttpResponse - Response that contains the Tier Permission Page
        Throws:
        APIManagerIntegrationTestException - - Exception throws from checkAuthentication() method and HTTPSClientUtils.doGet() method call
      • getAPIManagePage

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getAPIManagePage​(String apiName,
                                                                                               String provider,
                                                                                               String version)
                                                                                        throws APIManagerIntegrationTestException
        Retrieve the API Manage Page
        Parameters:
        apiName - - Name of the API.
        provider - - Name of the API Provider.
        version - - Version of the API.
        Returns:
        HttpResponse - Response that contains the API Manage Page
        Throws:
        APIManagerIntegrationTestException - - Exception throws from checkAuthentication() method and HTTPSClientUtils.doGet() method call
      • getAPIInformationPage

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getAPIInformationPage​(String apiName,
                                                                                                    String provider,
                                                                                                    String version)
                                                                                             throws APIManagerIntegrationTestException
        Retrieve the API Information Page
        Parameters:
        apiName - - Name of the API.
        provider - - Name of the API Provider.
        version - - Version of the API.
        Returns:
        HttpResponse - Response that contains the API Information Page
        Throws:
        APIManagerIntegrationTestException - - Exception throws from checkAuthentication() method and HTTPSClientUtils.doGet() method call
      • addDocument

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse addDocument​(String apiName,
                                                                                          String version,
                                                                                          String provider,
                                                                                          String docName,
                                                                                          String docType,
                                                                                          String sourceType,
                                                                                          String docUrl,
                                                                                          String summary,
                                                                                          String docLocation,
                                                                                          String mimeType,
                                                                                          String newType)
                                                                                   throws APIManagerIntegrationTestException
        Adding a Document to a API
        Parameters:
        apiName - - Name of the API.
        version - - Version of the API.
        provider - - Name of the API Provider.
        docName - - Name of the Document
        docType - - Document Type
        sourceType - - Source Type
        docUrl - - Document URL
        summary - - Document summary
        docLocation - - Document Location
        Returns:
        HttpResponse - Response with Document adding result.
        Throws:
        APIManagerIntegrationTestException - - Exception throws from checkAuthentication() method and HTTPSClientUtils.doPost() method call
      • addDocument

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse addDocument​(String apiName,
                                                                                          String version,
                                                                                          String provider,
                                                                                          String docName,
                                                                                          String docType,
                                                                                          String sourceType,
                                                                                          String docUrl,
                                                                                          String summary,
                                                                                          String docLocation)
                                                                                   throws APIManagerIntegrationTestException
        Adding a Document to a API
        Parameters:
        apiName - - Name of the API.
        version - - Version of the API.
        provider - - Name of the API Provider.
        docName - - Name of the Document
        docType - - Document Type
        sourceType - - Source Type
        docUrl - - Document URL
        summary - - Document summary
        docLocation - - Document Location
        Returns:
        HttpResponse - Response with Document adding result.
        Throws:
        APIManagerIntegrationTestException - - Exception throws from checkAuthentication() method and HTTPSClientUtils.doPost() method call
      • addDocument

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse addDocument​(AddDocumentRequestBean addDocRequestBean)
                                                                                   throws APIManagerIntegrationTestException
        Adding a Document to a API using AddDocumentRequestBean
        Parameters:
        addDocRequestBean - - Bean that contains all the values that needed to create a Document.
        Returns:
        HttpResponse - Response with Document adding result.
        Throws:
        APIManagerIntegrationTestException - - Exception throws from checkAuthentication() method and HTTPSClientUtils.doPost() method call
      • getAllAPIs

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getAllAPIs()
                                                                                  throws APIManagerIntegrationTestException
        Retrieve the All APIs available for the user in Publisher.
        Returns:
        HttpResponse - Response that contains all available APIs for the user
        Throws:
        APIManagerIntegrationTestException - - Exception throws from checkAuthentication() method and HTTPSClientUtils.doGet() method call
      • addAPI

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse addAPI​(APICreationRequestBean creationRequestBean)
                                                                              throws APIManagerIntegrationTestException
        Add a API using APICreationRequestBean object
        Parameters:
        creationRequestBean - - Instance of APICreationRequestBean object with all needed information to create the API.
        Returns:
        HttpResponse - Response that contains the result of APi creation activity.
        Throws:
        APIManagerIntegrationTestException - - Exception throws from checkAuthentication() method and HTTPSClientUtils.doPost() method call
      • uploadCertificate

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse uploadCertificate​(ClientCertificateCreationBean clientCertificateCreationBean)
                                                                                         throws APIManagerIntegrationTestException
        To upload a client certificate against an API.
        Parameters:
        clientCertificateCreationBean - Client Certificate Creation Bean with required information for uploading client certificate.
        Returns:
        Http response after uploading the certificate.
        Throws:
        APIManagerIntegrationTestException - API Manager Integration Test Exception.
      • updateAPI

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse updateAPI​(APICreationRequestBean creationRequestBean)
                                                                                 throws APIManagerIntegrationTestException
        Update a API using APICreationRequestBean object
        Parameters:
        creationRequestBean - - Instance of APICreationRequestBean object with all needed information to Update the API.
        Returns:
        HttpResponse - Response that contains the result of APi creation activity.
        Throws:
        APIManagerIntegrationTestException - - Exception throws from checkAuthentication() method and HTTPSClientUtils.doPost() method call
      • designAPI

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse designAPI​(APIDesignBean designBean)
                                                                                 throws APIManagerIntegrationTestException
        Design an API using APIDesignBean object
        Parameters:
        designBean - -Instance of APIDesignBean object with all needed information to create an API up to design level.
        Returns:
        HttpResponse -Response that contains the results of API creation up to design level
        Throws:
        APIManagerIntegrationTestException - - Exception throws from checkAuthentication() method and HTTPSClientUtils.doPost() method call
      • getAPIImplementPage

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getAPIImplementPage​(String apiName,
                                                                                                  String provider,
                                                                                                  String version)
                                                                                           throws APIManagerIntegrationTestException
        Retrieve implementation page for the requested API
        Parameters:
        apiName - - Name of the API
        provider - - Provider of the API
        version - -Version of the API
        Returns:
        - Response that contains the implementation page of the API
        Throws:
        APIManagerIntegrationTestException - - Exception throws from checkAuthentication() method and HTTPSClientUtils.doGet() method call
      • checkValidAPIName

        public org.wso2.carbon.automation.test.utils.http.client.HttpResponse checkValidAPIName​(String apiName)
                                                                                         throws APIManagerIntegrationTestException
        Validate API Name when creating a new API
        Parameters:
        apiName - - Name of the API
        Returns:
        - Response that contains the API is valid or not..
        Throws:
        APIManagerIntegrationTestException - - Exception throws from checkAuthentication() method and HTTPSClientUtils.doPost() method call