0

I want to use the Scopus API to verify that a DOI exists. I'm using the "Cited By" option. I did a test of this "http://api.elsevier.com/content/search/scopus?query=DOI(10.1016/j.stem.2011.10.002)" link in POSTMAN and it works, but when I did the implementation in Angular this is what returns.

Angular code

let headers = new Headers({ 
            'X-ELS-APIKey': apikey,
            'Accept': 'application/json',
        });
        this._http.get('http://api.elsevier.com/content/search/scopus?query=DOI(' + doi + ')', { headers: headers }).pipe(map(res => res.json())).subscribe(
            response => {
                console.log("Response");
                console.log(response);
            },
            error => {
                console.log("Error");
                console.log(error);
            }
        );

Any help is greatly appreciated :)

Francisca GV
  • 379
  • 4
  • 11
  • Dear Franciska, I thought you may have a good experience for using Scopus API. I have a problem for refreshing my dataset (dashboard) on power bi web. It will grateful if you take a look to this my question. Your help or recommendation is greatly appreciated. Thanks,,, Mahdi https://stackoverflow.com/questions/59067207/refresh-power-bi-dataset-connected-to-scopus-database – Mahdi Hadi Nov 30 '19 at 11:18

1 Answers1

0

Finally I solved it, the problem was that the "doi" string needed to go through the encodeURIComponent() function. I leave the code in case someone needs it.

welcome.component.ts:

let doi = encodeURIComponent('10.1017/j.stem.2011.10.002');
this._scopusService.getPublication(doi).subscribe(
    response => {
    console.log("DOI exists");
},
error => {
    console.log("DOI doesn't exists");
}

scopus.service.ts:

public getPublication(doi) {
    let headers = new Headers({
        'Accept': 'application/json',
        'X-ELS-APIKey': this.apiKey
    });

    return this._http.get('https://api.elsevier.com/content/search/scopus?query=DOI(' + doi + ')', { headers: headers }).pipe(map(res => res.json()));
}
Francisca GV
  • 379
  • 4
  • 11