Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

365farmnet

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

365farmnet

Node.js client for the 365FarmNet Connect REST API

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by33.33%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 01 Jul 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc