Skip to content

DKE-Data/agrirouter-postman-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agrirouter-postman-tools

Abstract

agrirouter

The agrirouter is a universal data exchange platform for farmers and agricultural contractors that makes it possible to connect machinery and agricultural software, regardless of vendor or manufacturer. Agrirouter does not save data; it transfers data. As a universal data exchange platform, agrirouter fills a gap on the way to Farming 4.0. Its underlying concept unites cross-vendor and discrimination-free data transfer. You retain full control over your data. Even data exchange with service providers (e.g. agricultural contractors) and other partners is uncomplicated: Data are very rapidly transferred via the online connection, and if you wish, is intelligently connected to other datasets.

The current project you are looking at

The agrirouter postman tools can be used to onboard endpoints to check simulate the onboarding. The Postman Collection includes request templates for onboarding, message sending to the inbox and message requesting from the outbox. The nodejs servers are used to provide some required functionalities that could not be implemented in postman.

Setup

Usage

Onboarding

Decide, if you want to onboard a CU or a farming software or a telemetry platform

Preparation

  • Select Environment (we advice agrirouter-QA eu10)


Select environment

Onboard a CU:

  • Receive a registration code through the agrirouter UI (see https://lb.my-agrirouter.com/en/connect-the-machine/ )

  • Open Request "Onboarding CU" and select Onboarding Request in Postman

  • Enter your app information in the "PreRequestScripts"

    • endpoint_reg_code is where the registration token from the authorization request shall be stored

    • reg_external_id use this to create an external id; we advice a UUID of form urn:uuid:324234…​.

  • Send Request

⇒ Receive onboarded app credentials

⇒ The data is written to different environment variables

Onboard a farming software or a telemetry platform:

Authorization

Receive a registration code throught the authorization process (see Authorization Server below)

Onboarding
  • Open Request Onboarding FMIS&Telemetry and select 01_GetSignature

  • Enter your app information in the PreRequestScripts

  • Setup and start the node server for signature creation (see Node Server for Signature Creation)

  • Send Request ⇒ You will receive the signature which is required for the secured onboarding

  • (optional) Select request 02_Verify Request Secure and click send to get an account id and to check, if the data you received so far is valid

  • Select Request 03_Onboarding Request Secure and click send to receive the onboarding credentials

⇒ Receive onboarded app credentials

⇒ The data is written to different environment variables

Save certificates to be used with postman for agrirouter

  • Open Environment variables list by clicking


Open environment variables

  • Copy value of environment variable endpointAuthCertificate

  • Open Nodepad++ or an editor and replace "\n" by an actual line break


Replace Linebreaks

  • Save the first part of the text ("-----BEGIN ENCRYPTED PRIVATE KEY----- …​ -----END ENCRYPTED PRIVATE KEY-----" ) to a file private.key

  • Save the second part of the text ("-----BEGIN CERTIFICATE----- …​ -----END CERTIFICATE-----") to a file key.cert

  • To use the certificate in postman, it needs to be converted, e.g. using openssl.

    • Start command line and navigate to the folder where the key-file is stored.

    • Run openssl pkey -in private.key -out serv.key -des3

    • As password, use the value from endpointAuthSecret (as well for the new password)

Communication with an endpoint

Preparation

For communication with agrirouter, you need to setup the credentials. They are automatically added, when you performed the onboarding process before.

The certificates required for communication need to be added by hand:


Adding the certificate in Postman

  • As private key, use serv.key

  • As certificate, use key.cert

  • The passkey can be found in the environment variable endpointAuthSecret

Sending requests to the inbox

  • Select agrirouter: Messaging / 01 - Send Message to agrirouter

  • Set the request in the environment variable encoded_request

  • Send the request

Remark

Requests are base64-encoded protobuf-structures. Check the documentation on how to build messages

For initial tests you can use the agrirouter protobuf toolset.

Authorization Server

To create a registration code for Farming Software and Telemetry platforms, we provide a small example server tool. It can be found in "./authorization-server"

SETUP of your application

To make your application compatible with this tool, you need to setup the redirect-URL as "http://fuf.me:8080/auth".

Start authorization server

  • navigate to the authorization-server folder in command line

  • call npm install to install all required libraries

  • call node index.js to run the program

  • provide your applicationId

  • call the echoed url

  • The registration code can be found in "regcode"

Node server for signature creation

The NodeJS Server for signature creation is required to create an application signature for the FMIS- and Telemetry onboarding process. It can be found in ./signature-creator.

Setup

  • Open a console and navigate to the folder of the tool

  • call npm install to install all required libraries

  • call node index.js to run the program

About

Tools to work with the REST Interface of the agrirouter.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published