GitHub
github.com › saro-mano › Hackerrank-Rest-API
GitHub - saro-mano/Hackerrank-Rest-API: Solution for Hackerrank REST API Certification · GitHub
Python solution for Hackerrank REST API Certification (Intermediate)
Starred by 14 users
Forked by 9 users
Languages Python
python - Can we put condition on REST API - Stack Overflow
Copyimport requests year = 2011 .../jsonmock.hackerrank.com/api/football_matches?year='+str(year)+'&page='+str(page)).json() try: for i in range(0, per_page): if int(r['data'][i]['team1goals']) == int(r['data'][i]['team2goals']): draw += 1 except: pass print(draw) #516 · It is giving me correct answer. Since the data was big, it is facing time complexity which I don't want · Is it possible, Can we modify the REST API with condition ... More on stackoverflow.com
What Library to use for HackerRank Rest API Skills Challenge?
Update (in case anyone else has the question): environment details and list of dependencies on the class path. More on reddit.com
HackerRank Solving rest APIs with Algos
A message I wrote to someone who came across this post asking for help. I hope this is useful for anyone else who comes across this: I am so sorry I was not able to reply in a timely manner. I am hardly on here. If this is still relevant to you, I would recommend studying for and getting this certificate. It's pretty easy and entails that you know how to consume an API and parse it and use its data. There are free intermediate and advanced certificates from Hackerrank. It doesn't really mean anything as far as the industry is concerned but preparing for it will help prepare you for future REST API Hackerranks and it's a nice little filler certificate to put on LinkedIn. https://www.hackerrank.com/skills-directory/rest_api_intermediate This is a video I used to help prepare. https://newsapi.org/ In general, I'd recommend finding an open API and play around with it using your language of choice. Off the top of my head, https://newsapi.org/ is a free one you can use. I hope this helps. More on reddit.com
HackerRank Solving rest APIs with Algos
How do you "solve" a REST API? That doesn't make sense. More on reddit.com
Videos
GitHub
github.com › saro-mano › Hackerrank-Rest-API › blob › master › soln2.py
Hackerrank-Rest-API/soln2.py at master · saro-mano/Hackerrank-Rest-API
#!/bin/python3 · · import math · import os · import random · import re · import sys · · · · # # Complete the 'getNumDraws' function below. # # The function is expected to return an INTEGER. # The function accepts INTEGER year as parameter. # import requests · import json · · def getNumDraws(year): url1 = "https://jsonmock.hackerrank.com/api/football_matches?year=" + str(year) response1 = requests.get(url1) result1 = json.loads(response1.content) curr_1 = 1 ·
Author saro-mano
GitHub
github.com › sumantopal07 › Rest-API-Intermediate-Hackerrank-Test
GitHub - sumantopal07/Rest-API-Intermediate-Hackerrank-Test · GitHub
const fetch = require("node-fetch"); async function getDrawnMatches(year) { let goals=[]; let ans=0; for(let goal=0;goal<=10;goal++) { const myPromise = fetch(`https://jsonmock.hackerrank.com/api/football_matches?year=${year}&team1goals=`+goal+`&team2goals=`+goal) .then(res => res.json()) .then(data => { console.log(data.total,goal); return data.total }); goals.push(myPromise); } await Promise.all(goals).then((array)=>{ array.forEach( item =>{ ans+=item; }) }) return ans; } getDrawnMatches (2011).then((answer) => console.log(answer));
Starred by 37 users
Forked by 8 users
GitHub
github.com › 3RB16 › Rest-API-Intermediate-hackerrank-solution › blob › main › getWinnerTotalGoals.py
Rest-API-Intermediate-hackerrank-solution/getWinnerTotalGoals.py at main · 3RB16/Rest-API-Intermediate-hackerrank-solution
URL = 'https://jsonmock.hackerrank.com/api/football_matches'
· r = requests.get(url = URL, params = params(team, year, page, whichTeam, compeition))
· data = r.json()
· return data
·
· def handleData(team, whichTeam,compeition):
·
Author 3RB16
HackerRank
hackerrank.com › skills-verification › rest_api_intermediate
Rest API Intermediate Certificate
Proficiency in MySQL, a critical aspect of database management, is evaluated through database design, SQL queries, normalization, and optimization techniques. Additionally, expertise in REST APIs, vital for modern web applications, is assessed in terms of RESTful principles, HTTP methods, authentication, and API design best practices.
YouTube
youtube.com › shreyash joshi
REST API using Python || Online Assessment || Placement || Hackerrank - YouTube
Here, I have used python notebook
Published August 6, 2023 Views 776
Top answer 1 of 3
2
If the API allows these many calls, you can use a multiprocessing.pool.Pool function and iterate through each page parallelly to reduce time. This should work:
Copyimport requests
from functools import partial
from multiprocessing.pool import Pool
def loop(page,year,r,per_page):
r = requests.get('https://jsonmock.hackerrank.com/api/football_matches?year='+str(year)+'&page='+str(page)).json()
try:
for i in range(0, per_page):
if int(r['data'][i]['team1goals']) == int(r['data'][i]['team2goals']):
increase = 1
else:
increase = 0
except:
increase = 0
return increase
if __name__ == "__main__":
year = 2011
draw = []
r = requests.get('https://jsonmock.hackerrank.com/api/football_matches?year='+str(year)+'&page=1').json()
total_pages = r['total_pages']
per_page = r['per_page']
pages = range(1, total_pages+1)
pool = Pool()
f = pool.map(partial(loop,year=year,r=r,per_page=per_page),pages)
draw += f
final = 0
for x in draw:
x = int(x)
final += x
print(final) #516
2 of 3
2
You should use multithreading and make multiple requests in parallel.
Brainly
brainly.com › sat › high school › provide a solution for the "top article" rest api challenge on hackerrank.
[FREE] Provide a solution for the "Top Article" REST API challenge on HackerRank. - brainly.com
An example of how a person could implement a REST API solution using the requests library in Python is : ... In the above code, one need to the get_article_title feature gets a website address as information and uses a toolbox called "requests" to get information from that website. Therefore, one need to have to change 'https://example. com/api/article' to the real API URL given in the HackerRank ...
HackerRank
hackerrank.com › skills-directory › rest_api_advanced
REST API (Advanced) | Skills Directory | HackerRank
Build a REST API Service - Using any framework of choice, the ability to build a complete backend REST API Service.
Top answer 1 of 2
6
import requestsimport localedef maximumTransfer(name, city): # Initialize variables to store the maximum credit and debit amounts max_credit = 0.0 max_debit = 0.0 # Initialize the page number to 1 and the base API URL page = 1 base_url = 'https://jsonmock.hackerrank.com/api/transactions' while True: # Make the API request with the current page number response = requests.get(f'{base_url}?page={page}') data = response.json() # Iterate through the transaction records in the data for record in data['data']: # Filter records based on the given name and city if record['userName'] == name and record['location']['city'] == city: amount = float(record['amount'].replace('$', '').replace(',', '')) # Update the maximum credit and debit amounts if applicable if record['txnType'] == 'credit': max_credit = max(max_credit, amount) elif record['txnType'] == 'debit': max_debit = max(max_debit, amount) # Check if there are more pages to retrieve if page < data['total_pages']: page += 1 else: # If there are no more pages, break out of the loop break # Set the locale to en_US to format numbers as dollars locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') # Format the results as strings in dollar format credit_amount_str = locale.currency(max_credit, grouping=True) debit_amount_str = locale.currency(max_debit, grouping=True) # Return the results as a list of strings return [credit_amount_str, debit_amount_str]Explanation:
2 of 2
0
Explanation:koi answer bta do
Gitbook
dailyjournal.gitbook.io › solutions › hackerrank-solutions › certify › rest-api-intermediate
Rest API (Intermediate) | HackerRank | Solutions
In this challenge, the REST API contains information about football matches. The provided API allows querying matches by teams and year. The task is to get the number of matches for a given year that ended in a draw. A match is drawn when both teams scored the same number of goals. To access a collection of matches played in a given year, perform an HTTP GET request to https://jsonmock.hackerrank...
LinkedIn
linkedin.com › posts › sakhi-chatterjee_rest-api-intermediate-activity-7354928247526092801-F_M_
Solved REST API challenges on HackerRank using Python
We cannot provide a description for this page right now
GitHub
github.com › kaarthikraajan › rest-api-hackerrank
GitHub - kaarthikraajan/rest-api-hackerrank: This is a solution to the problem presented in the hackerrank problem.
kaarthikraajan / rest-api-hackerrank Public · Notifications · You must be signed in to change notification settings · Fork 2 · Star 6 · This is a solution to the problem presented in the hackerrank problem. 6 stars 2 forks Branches Tags Activity · Star · Notifications ·
Starred by 6 users
Forked by 2 users
Languages Java 100.0% | Java 100.0%
YouTube
youtube.com › watch
Hackerrank Certification REST APIs Certification (Football matches APIs) #hackerrank - YouTube
This Video is a part of playlist "Crack javascript Interviews"https://www.youtube.com/watch?v=ET3IiPLI-JI&list=PLIGDNOJWiL18kcjnrT0KT64bo-kOYyQUF&ab_channel=
Published May 16, 2023
YouTube
youtube.com › watch
HackerRank API Interview Question and Answer - YouTube
I'm coding a HackerRank api interview question and answer. I use the given API to set up and code an answer to the problem. I know there could be other ways ...
Published January 19, 2021 Views 60K
HackerRank
hackerrank.com › work › apidocs
HackerRank for Work API
The HackerRank for Work API is organized around REST. Our API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which are understood by off-the-shelf HTTP clients.