🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

node-red-contrib-getnet

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

node-red-contrib-getnet

Getnet API wrapper for Node-Red

1.0.4
unpublished
latest
Source
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

node-red-contrib-getnet-api

Getnet

This node enables you to work with the Getnet Digital Platform API, giving you the ability to set parameters through the Node-RED-UI and trigger the flow from within your existing flow.

It is based on Getnet Digital Platform API.

Usage

Getnet

image

1. Get the API-operations list

Operations

2. Understanding the API

Hovering on an operations title or a key, you see the respective comments within the mouseover. This allows you to understand what a parameter is meant for. Required parameters are marked with an asterisk.

parameter description

For JSON-parameters you can further show the structure by clicking on show keys. Again, the comments can be found within the mouseover.

json description

3. Parameter configuration

Each parameter has an input-field corresponding to its type. You can further define that a parameter shall be read from the incoming message object or define a jsonata expression.

JSON parameters may define a sample structure. You can set this as the value by clicking the corresponding button - either with only the required keys (set required) or with all keys (set default).

4. Authentification

If the API requires an authentification token you can log in using the standard http-request node of Node-RED. The JWT token you get as a response must then be put into msg.openApiToken to be automatically placed in the request-header as bearer authentification. In case you would like to use a different authentification than bearer, you can use msg.headers as you can do with the default http request node of Node-RED.

Both message object will be deleted afterwards if you do not set the option "Keep authentification".

5. Error handling

You can choose how to handle a returning server error. The last server response object will be placed in msg.response instead of msg.error. This ensures that all 3 ways react the same.

  • Standard: The flow moves on normally. You have to handle an server error in your flow.
  • Separate output: Your flow will take a different way.
  • Throw an exception: Throws an node.error which can be catched by the standard 'catch' node (usefull for many nodes with the same error handling).

Sample

image

[{"id":"39673f6d2cb0b3b2","type":"group","z":"348240cef6de04ff","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["e0f693cd0926f0b8","3a488550f6015369","6de90ecc2bf97768"],"x":174,"y":179,"w":672,"h":82},{"id":"e0f693cd0926f0b8","type":"getnet","z":"348240cef6de04ff","g":"39673f6d2cb0b3b2","name":"","api":"Autenticação","server":"","keepAuth":false,"alternServer":false,"operation":"post/auth/oauth/v2/token","operationData":{"summary":"Geração do token de acesso","description":"Endpoint responsável pela geração do token de acesso utilizado nas demais requisições, para isso utilizamos [HTTP Basic Authentication](https://www.w3.org/Protocols/HTTP/1.0/draft-ietf-http-spec.html#BasicAA)","tags":["Autenticação"],"consumes":["application/x-www-form-urlencoded"],"produces":["application/json"],"parameters":[{"in":"formData","required":true,"type":"string","name":"grant_type","description":"Usar O valor fixo \"client_credentials\"","default":"client_credentials"},{"in":"formData","required":true,"type":"string","name":"scope","description":"Usar o valor fixo \"oob\"","default":"oob"},{"in":"header","name":"Authorization","required":true,"type":"string","description":"Authorization: Basic *AuthString* </br> Onde *AuthString* é a concatenação do seu Client ID, seguido de “:” (dois pontos) mais seu Client Secret, convertidos para base64. <br> Como exemplo: Para o Client ID igual a client-01 e Client Secret igual a secret-key-02, teremos o texto client-01:secret-key-02 após a concatenação, convertendo para base64 teremos o resultado Y2xpZW50LTAxOnNlY3JldC1rZXktMDI=.</br> Neste caso o  Authorization no header da requisição será: </br> Authorization: Basic Y2xpZW50LTAxOnNlY3JldC1rZXktMDI=\n"},{"in":"header","name":"Content-type","required":true,"type":"string","enum":["application/x-www-form-urlencoded"],"default":"application/x-www-form-urlencoded","description":"Tipo do conteúdo padrão application/x-www-form-urlencoded.\n"}],"responses":{"200":{"description":"Retorna o token de acesso.","schema":{"type":"object","properties":{"access_token":{"type":"string","description":"Token de acesso a API para envio em todas as requisições","example":"ca22a2ge-1914-4b0c-a0fb-d3ce0fde7346","format":"uuidv4","minLength":36,"maxLength":36},"token_type":{"type":"string","description":"Tipo do token, deve ser enviado no header junto do token (https://tools.ietf.org/html/rfc6750)","example":"Bearer"},"expires_in":{"type":"number","description":"Tempo de expiração do token em segundos","example":3600},"scope":{"type":"string","description":"Escopo do token","example":"oob"}}}},"400":{"description":"Requisição inválida.","schema":{"type":"object","properties":{"error":{"type":"string","description":"Mensagem de erro."},"error_description":{"type":"string","description":"Descrição do erro."}},"$$ref":"#/definitions/error_authentication"}},"401":{"description":"Não autorizado.","schema":{"type":"object","properties":{"error":{"type":"string","description":"Mensagem de erro."},"error_description":{"type":"string","description":"Descrição do erro."}},"$$ref":"#/definitions/error_authentication"}}},"x-code-samples":[{"lang":"cURL","source":"curl -X POST \\\nhttps://api-homologacao.getnet.com.br/auth/oauth/v2/token \\\n-H 'authorization: Basic Y2xpZW50LTAxOnNlY3JldC1rZXktMDI=' \\\n-H 'content-type: application/x-www-form-urlencoded' \\\n-d 'scope=oob&grant_type=client_credentials'\n"}],"operationId":"post/auth/oauth/v2/token","withoutOriginalOpId":true,"pathName":"/auth/oauth/v2/token","method":"post","path":"/auth/oauth/v2/token"},"errorHandling":"Standard","internalErrors":{"readUrl":false},"parameters":[{"id":"grant_typeformData","name":"grant_type","in":"formData","required":true,"value":"client_credentials","isActive":true,"type":"str","allowedTypes":["str","json","jsonata","msg","flow","global"],"description":"Usar O valor fixo \"client_credentials\"","schema":null,"keys":null,"showDescription":false},{"id":"scopeformData","name":"scope","in":"formData","required":true,"value":"*","isActive":true,"type":"str","allowedTypes":["str","json","jsonata","msg","flow","global"],"description":"Usar o valor fixo \"oob\"","schema":null,"keys":null,"showDescription":false},{"id":"Authorizationheader","name":"Authorization","in":"header","required":true,"value":"Basic dW5kZWZpbmVkOnVuZGVmaW5lZA==","isActive":true,"type":"str","allowedTypes":["str","json","jsonata","msg","flow","global"],"description":"Authorization: Basic *AuthString* </br> Onde *AuthString* é a concatenação do seu Client ID, seguido de “:” (dois pontos) mais seu Client Secret, convertidos para base64. <br> Como exemplo: Para o Client ID igual a client-01 e Client Secret igual a secret-key-02, teremos o texto client-01:secret-key-02 após a concatenação, convertendo para base64 teremos o resultado Y2xpZW50LTAxOnNlY3JldC1rZXktMDI=.</br> Neste caso o  Authorization no header da requisição será: </br> Authorization: Basic Y2xpZW50LTAxOnNlY3JldC1rZXktMDI=\n","schema":null,"keys":null,"showDescription":false},{"id":"Content-typeheader","name":"Content-type","in":"header","required":true,"value":"application/x-www-form-urlencoded","isActive":true,"type":"str","allowedTypes":["str","json","jsonata","msg","flow","global"],"description":"Tipo do conteúdo padrão application/x-www-form-urlencoded.\n","schema":null,"keys":null,"showDescription":false}],"requestContentType":"application/json","responseContentType":"","showDescription":false,"devMode":false,"showBanner":true,"outputs":1,"x":490,"y":220,"wires":[["6de90ecc2bf97768"]]},{"id":"3a488550f6015369","type":"inject","z":"348240cef6de04ff","g":"39673f6d2cb0b3b2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":280,"y":220,"wires":[["e0f693cd0926f0b8"]]},{"id":"6de90ecc2bf97768","type":"debug","z":"348240cef6de04ff","g":"39673f6d2cb0b3b2","name":"debug 1","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":730,"y":220,"wires":[]}]

License

This repository and the code inside it is licensed under the MIT License. Read LICENSE for more information.

Developers

If you want to modify something inside the getnet.html file, I recommend to use SIR.

With help of SIR you can handle the getnet.svelte file in which the code is much cleaner and easier to handle.

Keywords

node-red

FAQs

Package last updated on 16 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts