diff --git a/biblio-tools/v1/wos/works/expandByUT.ini b/biblio-tools/v1/wos/works/expandByUT.ini new file mode 100644 index 0000000..02ee03f --- /dev/null +++ b/biblio-tools/v1/wos/works/expandByUT.ini @@ -0,0 +1,107 @@ +# OpenAPI Documentation - JSON format (dot notation) +mimeType = application/json + +post.operationId = post-v1-wos-works-expand +post.description = Récupération des informations associées à un UT dans la base Web of Science +post.summary = Récupération à partir d'un tableau d'objets avec à minima un champ value contenant le UT +post.tags.0 = biblio-tools +post.requestBody.content.application/json.example.0.id = 1 +post.requestBody.content.application/json.example.0.value = WOS:001039810800001 +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 UT +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('WOS_API_KEY') + +# Début du traitement par lot +[group] +size = env('size') + +# Création d'une requete avec une liste d'identifiants +[replace] +path = output.0.usrQuery +value = self().map('value').filter(Boolean).map(x => JSON.stringify(x)).join(' OR ').thru(allIdentifiers => `UT=(${allIdentifiers})`) + +path = output.0.databaseId +value = WOK + +path = output.0.count +value = env('size') + +path = output.0.firstRecord +value = 1 + +path = input +value = self() + +[map] +path = output + +# Envoi de la requete +[map/URLStream] +url = https://wos-api.clarivate.com/api/wos/ +header = env('token').prepend('X-ApiKey:') +path = Data.Records.records.REC.* +json = true +timeout = 30000 +retries = 3 +noerror = false + +# Suppression des réponses qui n'ont pas abouties +[map/remove] +test = get('UID').isEmpty() + +[map/OBJFlatten] + +# Création d'un objet réponse +[map/replace] +path = id +value = get('UID') +path = value +value = self() + +# Croisements des resultats et des ut +[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 = get('value.UID').isEmpty() + +[swing/assign] +path = value +value = fix('n/a') + +[dump] +indent = env('indent', false) +