Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using RestSharp;
- using RmcUtmScholar.Models;
- namespace RmcScholar.Helper
- {
- [Route("api/[controller]")]
- public class PublicationRepository : Controller
- {
- public async Task<SCHOLAR_INFO_DETAILS> GetH_Index_Citations(string id)
- {
- var client = new RestClient("https://api.elsevier.com/content/author/author_id/{id}?apiKey=91d28f0563469b909bacc58574650b33&httpAccept=application/json&view=METRICS");
- client.Timeout = -1;
- var request = new RestRequest(Method.GET);
- request.AddHeader("apiKey", "7169c2716d70c8dcff9124532b65e173");
- IRestResponse response = await client.ExecuteAsync(request);
- if (response.IsSuccessful)
- {
- var content = JsonConvert.DeserializeObject<JToken>(response.Content);
- var h_index = content["h-index"].Value<String>();
- var coauthor_count = content["coauthor-count"].Value<String>();
- return new SCHOLAR_INFO_DETAILS
- {
- H_INDEX = h_index,
- CITATIONS = coauthor_count
- };
- }
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment