Squale rest web services

  1. Web services

    Four services are available through the rest implementation :

    • serverUrl/rest/applications_full
    • serverUrl/rest/applications
    • serverUrl/rest/application/applicationId
    • serverUrl/rest/audit/auditId

    example : http://localhost:8080/squale-web/rest/application/1

    http://localhost:8080/squale-web/rest/application/1

    Note : When a factor has for value -1.0, that means this factor hasn't been computed.

    This web service :

    • use the basic authentication to verify you are an authenticated user in Squale.
    • can return the result in xml or json.
    • use the Locale linked to the http request for the result language.

    You can't use these web services if you haven't a Squale account.
    To choose the return type, use the "Accept" property in the html request header. Set the property to "application/json" to have result in json. In all other case the result will be in xml ("application/xml").
    Only English and French are available for the return language.

    1. serverUrl/rest/applications_full

      This service returns :

      • the list of all the applications which has at least one successful audit and are available for the current authenticated user.
      • for each visible application :
        • the modules of the application with their factors mark and volumetry metric for the last successful audit
        • the list of all the audit for the application

      An application is available for the authenticated user if the application is public or if the user as rights for the application.

    2. serverUrl/rest/applications

      This service returns :

      • the list of all the applications which has at least one successful audit and are available for the current authenticated user.

      An application is available for the authenticated user if the application is public or if the user as rights for the application.

    3. serverUrl/rest/application/applicationId

      This service returns:

      • the modules of the application whose id is applicationId with their factors mark and volumetry metric for the last successful audit
      • the list of all the audit for the application whose id is applicationId

      The service return the result only if the user has right on the application searched or if the application searched is a public application

    4. serverUrl/rest/audit/auditId

      This service returns:

      • the application and its modules with their factors marks and volumetry metric for the audit whose id is auditId

      The service return the result only if the user has right on the application linked to the audit searched or if the application linked to the audit searched is a public application

  2. Squale client

    This client do the http request for you and return the result as an object. This client is in squale-rest.jar

    Example :

            
            SqualeRestHttpClient httpClient = new SqualeRestHttpClient();
            
            String login = "login" ;
            String password = "password" ;
            String host =  "localhost" ;
            int port = 8080;
            String contextRoot = "squale-web";
            
            //Initialize the client
            httpClient.initialize( login, password, host, port, contextRoot );
            
            //Do the request
            Applications availableApplications = httpClient.getApplicationsFull();
            
            Applications availableApplications = httpClient.getApplications();
            
            ByApplication application = httpClient.getApplication( applicationId );
            
            ByApplication audit = httpClient.getAudit( auditId );
    

    Three request methods are available for the http client :

    • httpClient.getApplicationsFull() <--> serverUrl/rest/applications_full
    • httpClient.getApplications() <--> serverUrl/rest/applications
    • httpClient.getApplication( applicationId ) <--> serverUrl/rest/application/applicationId
    • httpClient.getAudit( auditId ) <--> serverUrl/rest/audit/auditId