# OpenAPI Documentation - JSON format (dot notation) mimeType = application/json post.operationId = post-v1-unpaywall-expand post.description = Récupération des informations OA associées à 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 # Rétablissons la coloration syntaxique (une ou deux apostrophes selon les besoins): ' value = fix('').join('') # 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 = output.0.query value = self().map('value').map(x => JSON.stringify(x)).join(',').thru(allIdentifiers => `{GetByDOI(dois:[${allIdentifiers}]){doi,is_oa,oa_status,has_repository_copy,best_oa_location{host_type},oa_locations{host_type,is_best,license,url,url_for_landing_page,url_for_pdf,version}}}`) path = input value = self() [map] path = output # Envoi de la requete [map/URLStream] url = https://unpaywall.inist.fr/api/graphql header = env('token').prepend('x-api-key:') path = data.GetByDOI.* timeout = 30000 retries = 5 noerror = false # Suppression des réponses qui n'ont pas abouties [map/remove] test = has('is_oa') reverse = true # Création d'un objet réponse [map/replace] path = id value = get('doi').toLower() path = value value = self().omit('best_oa_location', 'oa_locations') path = value.is_oa value = get('is_oa') path = value.oa_status value = get('oa_status') path = value.host_type value = get('best_oa_location.host_type', 'n/a') path = value.has_repository_copy value = get('has_repository_copy', 'n/a') # Croisements des resultats et des dois [exchange] value = get('input').map((i) => ({ ...i, value:_.get(_.find(self.output, {id:i.value}), 'value') })) # Fin du traitement par lot [ungroup] # 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')