# OpenAPI Documentation - JSON format (dot notation) mimeType = application/json post.operationId = post-v1-unpaywall-corhal post.description = Récupération de certaines métadonnées associées à un DOI dans la base Unpaywall post.summary = Récupération à partir d'un tableau d'objets avec à minima un champ value contenant le DOI post.tags.0 = biblio-tools post.requestBody.content.application/json.example.0.id = 1 post.requestBody.content.application/json.example.0.value = 10.4000/edc.9014 post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream post.requestBody.required = true post.responses.default.content.application/json.example.0.id = 1 post.responses.default.content.application/json.example.0.value = { ... } post.responses.default.content.application/json.schema.$ref = #/components/schemas/JSONStream post.responses.default.description = une réponse sous forme d'un objet ou n/a pour chaque DOI post.parameters.0.description = Indenter le JSON résultant post.parameters.0.in = query post.parameters.0.name = indent post.parameters.0.schema.type = boolean # Necessary plugins [use] plugin = basics # Flow configuration [JSONParse] separator = * # Quelques paramètres modifiables si besoin [env] path = size value = 10 path = indent value = true path = token value = env('UNPAYWALL_API_KEY') # Passage des doi en minuscule pour être compatible unpaywall [assign] path = value value = get('value').toLower() # Début du traitement par lot [group] size = env('size') # Création d'une requete graphql avec une liste de DOI [replace] path = request.query value = self().map('value').map(x => JSON.stringify(x)).join(',').thru(allIdentifiers => `{GetByDOI(dois:[${allIdentifiers}]){doi,is_oa,oa_status,has_repository_copy,oa_locations{host_type,is_best,license,url,url_for_landing_page,url_for_pdf,version}}}`) path = input value = self() # Envoi de la requete [URLFetch] url = http://vpunpaywallmir.intra.inist.fr:59700/api/graphql header = env('token').prepend('x-api-key:') path = request json = true target = output timeout = 5000 retries = 3 noerror = false # Reformatage des résulats (output) [map] path = output.data.GetByDOI # Suppression des réponses qui n'ont pas abouties [map/remove] test = has('is_oa') reverse = true # Création d'un objet reponse [map/replace] path = __id value = get('doi').toLower() path = value.is_oa value = get('is_oa') path = value.oa_status value = get('oa_status') path = value.has_repository_copy value = get('has_repository_copy') path = value.oa_locations value = get('oa_locations') # Reformatage des DOIS (input) [map] path = input # Création d'un objet similaire à l'objet reponse [map/replace] path = __id value = get('value') path = value value = self() # Croissements des resultats et des dois (avec le champ __id comme clé) [exchange] value = get('output.data.GetByDOI').unionBy(self.input, '__id') # Fin du traitement par lot [ungroup] # Suppression des champs ajoutés [exchange] value = self().omit('__id') # On marque les réponses qui n'ont pas abouti [swing] test = has('value.is_oa') reverse = true [swing/assign] path = value value = fix('n/a') [dump] indent = env('indent')