Catalog npm
PACKAGE EXPLORERView in registry

365farmnet

npm

Node.js client for the 365FarmNet Connect REST API

365farmnetagricultureapiconnect
Versions collected3
Direct dependencies7From release 0.0.3
Last observed20 Oct, 19:27 UTC

README

Current package documentation

365FarmNet Connect - Node.js client

A simple promise based client for the 365FarmNet Connect REST API.

Quick start

npm install 365farmnet

Note: This library requires Node.js > v.10.0

Import the library, and pass the partner ID and secret that you got from registering at https://devcon.365farmnet.com/.

const farmnet = require('365farmnet')({
  partnerId: 'yourPartnerId',
  secret: 'yourPartnerSecret'
})

Make requests to the 365FarmNet Connect REST API by calling the imported function (farmnet if you follow this example) in the following manner:

// farmnettoken is the JWT that is passed to the iframe within the 
// 365FarmNet main application
farmnet('fields', {
  token: farmnettoken,
  params: {
    includeGeometry: false,
    includeSoilType: true
  }
}).then(data => {
  // data will contain all fields of the farm
}).catch(err => {
  console.log(err)
})

API

The module exports a default function. It takes two arguments:

farmnet('endpoint', options)

NameDescription
endpoint string requiredThe REST API endpoint to call. See documentation for all available endpoints.
options.token string requiredThe token property of the options object needs to be a valid JWT farmnettoken.
options.params objectOptional query params for the API call.
options.data objectOptional body params for the API call (for POST/PUT requests).
options.method stringDefault: 'GET'. Can be any HTTP request method valid for the given endpoint.

Testing

Fork this repo, then put a credentials.js file in the root directory with the following content.

// content of the credentials.js file, which needs to be placed at the root of this repo
module.exports = {
  partnerId: 'your_partner_id',
  secret: 'your_secret'
}

Then run

npm test

This will spin up an Express.js server on http://localhost:3000/.

Login to your account at https://devcon.365farmnet.com/, click on the Developer tab -> Developer Playground. If all tests pass, you should see All test passed!, if not, check your console 😄

Contribution

Please feel free to submit an issue or a pull request!

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 3

Collected releases
VersionPublishedDirect dependenciesOpen version
0.0.3Registry latest1 Jul 20207
0.0.212 Apr 20196
0.0.112 Apr 20196

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
fruchtfolge/365farmnet

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:27 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:1bb002045f601be075d7ae0dea09cdbc92ee7108b2670c0627542ed27f0d3703