import {Component, OnDestroy, OnInit} from "@angular/core"; import {CommunityInfo} from "../openaireLibrary/connect/community/communityInfo"; import {CommunityService} from "../openaireLibrary/connect/community/community.service"; 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 {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties"; @Component({ selector: 'develop', template: `

Help developers
with OpenAIRE APIs.

For {{openaireEntities.RESULTS | lowercase}}

For {{openaireEntities.RESULTS | lowercase}} ({{openaireEntities.PUBLICATIONS | lowercase}}, {{openaireEntities.DATASETS | lowercase}}, {{openaireEntities.SOFTWARE | lowercase}} and {{openaireEntities.OTHER | lowercase}}) you can use the Selective Access APIs by adding the community parameter.
Selective Access APIs
APIs
Request examples:
  • Access “{{openaireEntities.PUBLICATIONS}}”
    GET https://api.openaire.eu/search/publications?community={{community.communityId}}
  • Access “Open Access {{openaireEntities.PUBLICATIONS}}”
    GET http://api.openaire.eu/search/publications?community={{community.communityId}}&OA=true
  • Access “{{openaireEntities.DATASETS}}”
    GET https://api.openaire.eu/search/datasets?community={{community.communityId}}
  • Access “{{openaireEntities.SOFTWARE}}”
    GET https://api.openaire.eu/search/software?community={{community.communityId}}
  • Access “{{openaireEntities.OTHER}}”
    GET https://api.openaire.eu/search/other?community={{community.communityId}}
` }) export class DevelopComponent implements OnInit, OnDestroy { public community: CommunityInfo; public openaireEntities = OpenaireEntities; public properties: EnvProperties = properties; private subscriptions: any[] = []; constructor(private communityService: CommunityService, private seoService: SEOService, private _meta: Meta, private _router: Router, private _title: Title) { } ngOnInit() { this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => { this.community = community; if (this.community) { /* 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.community.shortTitle; const title = "Develop | " + this.community.shortTitle; 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); } })); } ngOnDestroy() { this.subscriptions.forEach(subscription => { if (subscription instanceof Subscription) { subscription.unsubscribe(); } }); } }