Advertisement
Guest User

Untitled

a guest
Feb 27th, 2018
1,241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. API Key Info
  3. Your API key is  580525a34932cc77c576219b86fa.
  4.  
  5. The key you get here will be used to authorize you to access the partner and results APIs.
  6.  
  7. You are out of time on the project. (You ran out of time at Fri Sep 29 2017 02:01:22 GMT-0400 (EDT))
  8.  
  9. HubSpot Project
  10. It’s your first day at HubSpot, and you’re in charge of writing the logic to send invitations to a special two-day event in each country for HubSpot’s partners in those countries. We need to find the dates that’ll work best based on survey results that partners have sent in and determine how many people can attend.
  11.  
  12. You’re provided with an API that gives you a list of partners, their countries, and which dates they’re available in ISO 8601 format.
  13.  
  14. Another team will send out the invitations, but you need to tell them when we should host the event and who should attend by POSTing to an API.
  15.  
  16. The date you send in for the country should be the starting date of the two day period where the most partners can make it for both days in a row. In case of multiple dates with the same number of partners, pick the earlier date. If there are no two days in a row when any partners can make it, return null.
  17.  
  18. API Docs and Example
  19. To get the list of partners, send an HTTP GET to:
  20.  
  21. https://candidate.hubteam.com/candidateTest/v2/partners?userKey=580525a34932cc77c576219b86fa
  22.  
  23. Here's a sample response with 10 partners:
  24.  
  25. {
  26.    "partners": [
  27.        {
  28.            "firstName": "Darin",
  29.            "lastName": "Daignault",
  30.            "email": "ddaignault@hubspotpartners.com",
  31.            "country": "United States",
  32.            "availableDates": [
  33.                "2017-05-03",
  34.                "2017-05-06"
  35.            ]
  36.        },
  37.        {
  38.            "firstName": "Crystal",
  39.            "lastName": "Brenna",
  40.            "email": "cbrenna@hubspotpartners.com",
  41.            "country": "Ireland",
  42.            "availableDates": [
  43.                "2017-04-27",
  44.                "2017-04-29",
  45.                "2017-04-30"
  46.            ]
  47.        },
  48.        {
  49.            "firstName": "Janyce",
  50.            "lastName": "Gustison",
  51.            "email": "jgustison@hubspotpartners.com",
  52.            "country": "Spain",
  53.            "availableDates": [
  54.                "2017-04-29",
  55.                "2017-04-30",
  56.                "2017-05-01"
  57.            ]
  58.        },
  59.        {
  60.            "firstName": "Tifany",
  61.            "lastName": "Mozie",
  62.            "email": "tmozie@hubspotpartners.com",
  63.            "country": "Spain",
  64.            "availableDates": [
  65.                "2017-04-28",
  66.                "2017-04-29",
  67.                "2017-05-01",
  68.                "2017-05-04"
  69.            ]
  70.        },
  71.        {
  72.            "firstName": "Temple",
  73.            "lastName": "Affelt",
  74.            "email": "taffelt@hubspotpartners.com",
  75.            "country": "Spain",
  76.            "availableDates": [
  77.                "2017-04-28",
  78.                "2017-04-29",
  79.                "2017-05-02",
  80.                "2017-05-04"
  81.            ]
  82.        },
  83.        {
  84.            "firstName": "Robyn",
  85.            "lastName": "Yarwood",
  86.            "email": "ryarwood@hubspotpartners.com",
  87.            "country": "Spain",
  88.            "availableDates": [
  89.                "2017-04-29",
  90.                "2017-04-30",
  91.                "2017-05-02",
  92.                "2017-05-03"
  93.            ]
  94.        },
  95.        {
  96.            "firstName": "Shirlene",
  97.            "lastName": "Filipponi",
  98.            "email": "sfilipponi@hubspotpartners.com",
  99.            "country": "Spain",
  100.            "availableDates": [
  101.                "2017-04-30",
  102.                "2017-05-01"
  103.            ]
  104.        },
  105.        {
  106.            "firstName": "Oliver",
  107.            "lastName": "Majica",
  108.            "email": "omajica@hubspotpartners.com",
  109.            "country": "Spain",
  110.            "availableDates": [
  111.                "2017-04-28",
  112.                "2017-04-29",
  113.                "2017-05-01",
  114.                "2017-05-03"
  115.            ]
  116.        },
  117.        {
  118.            "firstName": "Wilber",
  119.            "lastName": "Zartman",
  120.            "email": "wzartman@hubspotpartners.com",
  121.            "country": "Spain",
  122.            "availableDates": [
  123.                "2017-04-29",
  124.                "2017-04-30",
  125.                "2017-05-02",
  126.                "2017-05-03"
  127.            ]
  128.        },
  129.        {
  130.            "firstName": "Eugena",
  131.            "lastName": "Auther",
  132.            "email": "eauther@hubspotpartners.com",
  133.            "country": "United States",
  134.            "availableDates": [
  135.                "2017-05-04",
  136.                "2017-05-09"
  137.            ]
  138.        }
  139.    ]
  140. }
  141. POST a JSON body to:
  142.  
  143. https://candidate.hubteam.com/candidateTest/v2/results?userKey=580525a34932cc77c576219b86fa
  144.  
  145. For the list of partners above, the proper API response to send would look like this:
  146.  
  147. {
  148.    "countries": [
  149.        {
  150.            "attendeeCount": 1,
  151.            "attendees": [
  152.                "cbrenna@hubspotpartners.com"
  153.            ],
  154.            "name": "Ireland",
  155.            "startDate": "2017-04-29"
  156.        },
  157.        {
  158.            "attendeeCount": 0,
  159.            "attendees": [],
  160.            "name": "United States",
  161.            "startDate": null
  162.        },
  163.        {
  164.            "attendeeCount": 3,
  165.            "attendees": [
  166.                "omajica@hubspotpartners.com",
  167.                "taffelt@hubspotpartners.com",
  168.                "tmozie@hubspotpartners.com"
  169.            ],
  170.            "name": "Spain",
  171.            "startDate": "2017-04-28"
  172.        }
  173.    ]
  174. }
  175. If your answer is correct, the API will return 200 OK. If the request is malformatted or incorrect, the API will return 400 along with a message indicating if the response is of the wrong structure or incorrect.
  176.  
  177. If you get a 5xx response, let us know and we'll help you out.
  178.  
  179. The candidate.hubteam.com domain is set up with a permissive cross-origin policy, so you can POST to it from any location in a browser if you choose to implement in an in-browser JS solution.
  180.  
  181. Evaluation
  182. When you’re done, you'll get an email with a link to upload your code. We’ll evaluate you based on three things:
  183.  
  184. First and foremost, if you complete the project within three hours.
  185. Next, the time from when you click the start button below to the time you submit a correct solution.
  186. Finally, the quality of code you submit. We're looking for simplicity, clarity and readability over cleverness or flexbility.
  187. We think you should be able to complete this project in a single sitting, so try to allocate a single block if you can.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement