Release Assembly - Topcoder Search Contests API Enhancement

Register
Submit a solution
The challenge is finished.

Challenge Overview

Project Overview

TopCoder and the TopCoder community have worked hard to get the platform to its currently level of maturity, but we're far from done. It's time to take the platform to the next level. TopCoder is going to start taking some steps to open up the platform API to the outside and community developers so they could incorporate it in their websites, applications or build their own applications (web, mobile or desktop).
The ultimate goal is to open up and build an "API" that is targeting all different type of audiences - Software and Studio Competitors, SRM/MM competitors, Copilots, Admins and TopCoder partners - each audience will have different interests and usages of the API, so it will be a huge project and we need to make sure that we are in the right direction from the beginning.

Competition Task Overview

The current implementation use hibernate to query the data from database and this contest should move the query to query tool and remove hibernate and dependency components.

Scope: 

  1. Search Contests - /contests
  • Remove "ALL" status.
  1. Remove Get all contest catalogs - /contestCatalogs
  2. Remove Get contest types for a contest catalog - /contestCatalogs/{catalogName}/contestTypes

Move queries from the component to the query tool, it means stop using tc_refactoring components (drop both components tc_refactoring_stage_1_review_and_search_services and tc_refactoring_stage_1_contest_services), move validation to the rest services and queries to query tool.

(Review Opps API will still use hibernate now so you can still keep the components in this contest but don't use that for the search contests API)

This also means queries needs to be rewritten, because filtering, pagination will be part of query, and all of them are optional. so queries need to be rewritten to include the optional fields in WHERE clause. In current components they are appended to query only if they are present, that is cannot be done when using query tool because the query in query tool cannot be changed from code level, so the filter parameters used by the API should be part of the query and should have default values or excluded from query if field not passed.

Note: the performance is very important for this contest. Please try to optimize the query.

You can play the current API here:

https://dev.topcoder.com/docs (you can find your key in "My Dashboard")

We find some issues in current API implementation, but make sure the rewritten queries in query tool doesn't have such issue, you should also test the API with other parameters to make sure it work as expected.

  1. Sort By Prize - ASC/DESC order is wrong: https://apps.topcoder.com/bugs/browse/TCAPI-29
  2. listType - ALL actually returns the result of "Active": https://apps.topcoder.com/bugs/browse/TCAPI-30
  3. Can't get Open contests - https://apps.topcoder.com/bugs/browse/TCAPI-34 Timeout or Internal Server Error
  4. Can't search contest by contest name - https://apps.topcoder.com/bugs/browse/TCAPI-41
  5. Can't search contests by catalog - https://apps.topcoder.com/bugs/browse/TCAPI-43 https://apps.topcoder.com/bugs/browse/TCAPI-88
  6. Can't search upcoming algorithm / bug hunt / test scenarios / test suites by contest type / name - https://apps.topcoder.com/bugs/browse/TCAPI-47 https://apps.topcoder.com/bugs/browse/TCAPI-96
  7. Can't search active contests by contest type - https://apps.topcoder.com/bugs/browse/TCAPI-52 / https://apps.topcoder.com/bugs/browse/TCAPI-83 
  8. Can't search test scenario contest: https://apps.topcoder.com/bugs/browse/TCAPI-91 / https://apps.topcoder.com/bugs/browse/TCAPI-92 / https://apps.topcoder.com/bugs/browse/TCAPI-93
  9. Can't search past contests: https://apps.topcoder.com/bugs/browse/TCAPI-100 https://apps.topcoder.com/bugs/browse/TCAPI-109 https://apps.topcoder.com/bugs/browse/TCAPI-113 https://apps.topcoder.com/bugs/browse/TCAPI-145 https://apps.topcoder.com/bugs/browse/TCAPI-146 https://apps.topcoder.com/bugs/browse/TCAPI-147
  10. Confusing Filter: https://apps.topcoder.com/bugs/browse/TCAPI-150
  11. Search Contest Parameters: https://apps.topcoder.com/bugs/browse/TCAPI-160
  12. Registration End Date Filter: https://apps.topcoder.com/bugs/browse/TCAPI-161
  13. 504 Error: https://apps.topcoder.com/bugs/browse/TCAPI-179
  14. Filter Issue: https://apps.topcoder.com/bugs/browse/TCAPI-182 https://apps.topcoder.com/bugs/browse/TCAPI-184 https://apps.topcoder.com/bugs/browse/TCAPI-186
  15. Page Index Issue: https://apps.topcoder.com/bugs/browse/TCAPI-187 https://apps.topcoder.com/bugs/browse/TCAPI-188 https://apps.topcoder.com/bugs/browse/TCAPI-190 https://apps.topcoder.com/bugs/browse/TCAPI-191
  16. Page Number: the API works when the page number is 1 but returns internal error when the page number is 2
  17. Reliability Bonus: https://apps.topcoder.com/bugs/browse/TCAPI-229
  18. Error Message: https://apps.topcoder.com/bugs/browse/TCAPI-233
  19. Bug Race: https://apps.topcoder.com/bugs/browse/TCAPI-243

You also need to verify this API with other parameters to make sure it work as expected.

Exception Handling

When some server error occurs, it will throw exception to end user directly.

It should follow the error codes responses here and return json error message

https://dev.twitter.com/docs/error-codes-responses

config.apiCodes = {
OK : {name : 'OK', value : 200, description : 'Success' },
notModified : {name : 'Not Modified', value: 304, description : 'There was no new data to return.' },
badRequest : {name : 'Bad Request', value: 400, description : 'The request was invalid. An accompanying message will explain why.' },
unauthorized : {name : 'Unauthorized', value: 401, description : 'Authentication credentials were missing or incorrect.' },
forbidden : {name : 'Forbidden', value: 403, description : 'The request is understood, but it has been refused or access is not allowed.' },
notFound : {name : 'Not Found', value: 404, description : 'The URI requested is invalid or the requested resource does not exist.' },
serverError : {name : 'Internal Server Error', value: 500, description : 'Something is broken. Please contact support.' }
};
with an optional "message" parameter for more details

Testing

You need to provide manual steps to verify your submission.

Existing Code

(Please send your request to subversion@topcoder.com if you don't have access)

tc_refactoring_stage_1_contest_services: https://coder.topcoder.com/tcs/clients/cronos/components/tc_refactoring_stage_1_contest_services/trunk

tc_refactoring_stage_1_review_and_search_services: https://coder.topcoder.com/tcs/clients/cronos/components/tc_refactoring_stage_1_review_and_search_services/trunk

web_module: https://coder.topcoder.com/internal/web_module/trunk

platform api: https://coder.topcoder.com/tcs/clients/cronos/applications/tc_platform_api/trunk

Virtual Machine (VM)

VM specific information is found here: http://www.topcoder.com/wiki/display/docs/VM+Image+2.5

Upon registration as a submitter or reviewer you will need to request a VM based on the TopCoder systems image. The VM will be active through aggregation review, after which it will be terminated except for the winner's and the reviewers'. To request your image, please post in contest forum.

Before requesting your VM, you need to ensure that you have an SSH key created and in your member profile. Instructions to do so are here: http://www.topcoder.com/wiki/display/projects/Generate+SSH+Key, and instructions to connect afterwards are here: http://www.topcoder.com/wiki/display/projects/Connect+Using+SSH+Key.

Please realize that VMs are currently issued manually. We make every attempt to issue the VM as soon as it is requested, however, there may be delays of up to 12 hours depending on time of day when you request. We encourage everyone to request a VM as soon as possible to minimize any such delays.

VMs will be granted only during registration phase!

Set up and Deploy API

The contestants are also required to update active docs and integrate the new APIs to 3scale. This set of APIs should be deployed in its own war. 
Refer to this document to deploy the API locally or on VM
https://coder.topcoder.com/tcs/clients/cronos/applications/tc_platform_api/trunk/doc/APIDG.docx
Refer to this document to setup 3scale integration
https://coder.topcoder.com/tcs/clients/cronos/applications/tc_platform_api/trunk/doc/3scale_DeploymentGuide.doc
Refer to this document for details about Active Docs deployment
https://coder.topcoder.com/tcs/clients/cronos/applications/tc_platform_api/trunk/doc/ActiveDocs_DG.doc



Final Submission Guidelines

N/A

Review style

Final Review

Community Review Board

Approval

User Sign-Off

Challenge links

ID: 30035819