import {Component, OnDestroy, OnInit} from "@angular/core"; import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service"; import {Stakeholder} from "../openaireLibrary/monitor/entities/stakeholder"; import {Subscription} from "rxjs"; import {Meta, Title} from "@angular/platform-browser"; import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; import {properties} from "../../environments/environment"; import {Router} from "@angular/router"; import {StakeholderUtils} from "../utils/indicator-utils"; @Component({ selector: 'develop', template: `

Develop

Help developers with OpenAIRE APIs

Not sure where to start? Let us give you some guides and request examples.

For research outcomes (publications, datasets, software and other research data) you can use the Selective Access APIs by adding the {{type}} parameter.

Request examples:

  • Access “Publications”
    GET https://api.openaire.eu/search/publications?funder={{stakeholder.index_shortName}}
  • Access “Open Access Publications”
    GET http://api.openaire.eu/search/publications?funder={{stakeholder.index_shortName}}&OA=true
  • Access “Datasets”
    GET https://api.openaire.eu/search/datasets?funder={{stakeholder.index_shortName}}
  • Access “Software”
    GET https://api.openaire.eu/search/software?funder={{stakeholder.index_shortName}}
  • Access “Other Research”
    GET https://api.openaire.eu/search/other?funder={{stakeholder.index_shortName}}

For projects you can use the Selective Access APIs and the Bulk Access APIs.

Request examples:

  • For the “Selective Access”
    https://api.openaire.eu/search/projects?funder={{stakeholder.index_shortName}}
  • For the “Bulk Access”
    DSpace endpoint: https://api.openaire.eu/projects/dspace/{{stakeholder.index_shortName}}/ALL/ ALL
    ePrints endpoint: https://api.openaire.eu/projects/eprints/{{stakeholder.index_shortName}}/ALL/ ALL
For more information on the full potential of the OpenAIRE APIs please check the OpenAIRE API Documentation.
`, styleUrls: ['develop.component.css'] }) export class DevelopComponent implements OnInit, OnDestroy { public stakeholder: Stakeholder; private subscriptions: any[] = []; private stakeholderUtils: StakeholderUtils = new StakeholderUtils(); public type: string; constructor(private stakeholderService: StakeholderService, private seoService: SEOService, private _meta: Meta, private _router: Router, private _title: Title) { } ngOnInit() { this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { this.stakeholder = stakeholder; if (this.stakeholder) { if(stakeholder.type !== "funder") { this.navigateToError(); } /* Metadata */ const url = properties.domain + properties.baseLink + this._router.url; this.seoService.createLinkForCanonicalURL(url, false); this._meta.updateTag({content: url}, "property='og:url'"); const description = "Develop | " + this.stakeholder.name; const title = "Develop | " + this.stakeholder.name; this._meta.updateTag({content: description}, "name='description'"); this._meta.updateTag({content: description}, "property='og:description'"); this._meta.updateTag({content: title}, "property='og:title'"); this._title.setTitle(title); /* Initializations */ this.stakeholderUtils.types.forEach(type => { if (type.value === stakeholder.type) { this.type = type.label; } }); } })); } private navigateToError() { this._router.navigate(['/error'], {queryParams: {'page': this._router.url}}); } ngOnDestroy() { this.subscriptions.forEach(subscription => { if (subscription instanceof Subscription) { subscription.unsubscribe(); } }); } }