Catalog npm
Back to packageRELEASE DETAILS

0.0.1

npm

365farmnet

Node.js client for the 365FarmNet Connect REST API

365farmnetagricultureapiconnect
Published12 Apr 2019
Direct dependencies6
Transitive dependenciesNot calculated

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.

Declared dependencies 6

Native requirements
6 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
axios
Environment
{
  "local_name": "axios",
  "alias": false,
  "peer_metadata": null
}
^0.18.0runtime
jsonwebtoken
Environment
{
  "local_name": "jsonwebtoken",
  "alias": false,
  "peer_metadata": null
}
^8.5.1runtime
eslint
Environment
{
  "local_name": "eslint",
  "alias": false,
  "peer_metadata": null
}
^5.16.0development
prettier
Environment
{
  "local_name": "prettier",
  "alias": false,
  "peer_metadata": null
}
1.16.4development
eslint-config-prettier
Environment
{
  "local_name": "eslint-config-prettier",
  "alias": false,
  "peer_metadata": null
}
^4.1.0development
eslint-plugin-prettier
Environment
{
  "local_name": "eslint-plugin-prettier",
  "alias": false,
  "peer_metadata": null
}
^3.0.1development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "9bbd7c582e5f138a03316768d71db900cc28233a",
  "tarball": "https://registry.npmjs.org/365farmnet/-/365farmnet-0.0.1.tgz",
  "fileCount": 10,
  "integrity": "sha512-5vMaNPIh7w5faNTfN7eaMFWtN5R1E8AW6hP6kN4w1hVz0yAG9V6uPA5wEJNN5PH+q/cOt0Xw3ywgfInOs0hC5w==",
  "signatures": [
    {
      "sig": "MEQCIFIFxCYA8zPUCm6Bf6p1d2mrFxoyp3MNResPOnBmA2cXAiB8NZVIKQTrvOTNvaDpPDE0bqx50bvt66PGAV2DlRG68w==",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 10822,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcsJ8JCRA9TVsSAnZWagAAx1sQAJyr7mbHkMa/FBhYmUGU\ntM4FD0pVRXAo9zs5qJgxO9atoVnLQHOv9JgNCNFzETxsP4aI+sQkv67zeaAn\nCwSMO4F5a4DhKWQU0TXz4FVZGTo2z2FV4C+I1vD7SXRIubmNO0CAJekwU58W\nWIX8XorMk3z05EOIwiGYYCKlIbXRPymxwLPjiVNmOnXuBA1COva2FSzPzWCb\nTWSlCUst1EeRxdkSRrFGpIHyNWpR/s6wfLnTzn1kep9hoge2uHS3vw7TtcB4\nynFeuLPp/jd/cHavB+Egk5U8NM+4Uefr7bezWJq0QsqzbIJiSKhw10tuC+Mh\nT+3ByCJXoO2BcGS4JSk+EUeZjVFnwvo055clLeXGLL0oX9ijhvXyzCjfcgWw\nXutpORzWalu4d3Qz1bCgRjFlg1BIHXhC/y4osYgXziHqJhyMax+IPGazhYRq\noua7TNEnjgOtpoDJtCKE2qGqpBdhRuAENUXcVF5/G4JOFaKXYSHN8pnUOaCI\nRLuTyf2IoRFpNO6I2mRyFAs9mOgqrWnlnwsJSC0cuBGsS4WJZNqbzEq903gc\nplaqq4/MgHw9fO7oPtA1zbxQS5vnfXi6G7jSqKusUHRc/x4DQ4LeSTOEWOgt\nMiNWEcEtJwoa8LHhBp60dXqqefQ08p7sY04r1/gXWGTUSqhXzuT4QiStacsf\n3YLh\r\n=WckI\r\n-----END PGP SIGNATURE-----\r\n"
}

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_version:46b2f17c7b6000c71875745eb6cf5c88cb20412d17b6cd07b8ae10eb08d644bd

Other collected versions

0.0.31 Jul0.0.212 AprView all collected versions →