@openfn/language-magpi
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

Language Magpi

Language Pack for building expressions and operations for working with the Magpi inbound API and the Magpi outbound API.

N.B.: The Magpi API is under development and this pack may change.

Documentation

Configuration

View all the required and optional properties for state.configuration in the official configuration-schema definition.

Fetch data from Magpi

Allows you to fetch data from Magpi and post it elsewhere.

Using fetchSurveyData:

https://www.magpi.com/api/surveydata/v2?username=taylordowns2000&accesstoken=blahblahblah&surveyid=921409679070

fetchSurveyData({
  surveyId: '37479',
  afterDate: '2016-01-01',
  beforeDate: '2100-01-01',
  postUrl: 'https://www.openfn.org/inbox/secret-5c25-inbox-ba2c-url',
});

Submit new records

wip: This will allow you to push data to Magpi to create a new record for a form which exists in a user account.

Using submitRecord:

submitRecord(1, 2);

Magpi Outbound API Parameters:

  • username: The account username.
  • accesstoken: The accesstoken generated on the site. Each accesstoken is associated with the user who generated.
  • surveyid: The surveyid is not the survey's name. The surveyid can be obtained from the list of forms generated in 1 above.
  • startdate: Start date of the data to be returned. Filtering is done based on the DateStamp and is inclusive.(Optional). The date format should be the same one as the one on the data tab/ The date format should be the same one as the one on the data tab
  • enddate: End date of the data to be returned. Filtering is done based on the DateStamp and is inclusive.(Optional)

Development

Clone the adaptors monorepo. Follow the Getting Started guide inside to get set up.

Run tests using pnpm run test or pnpm run test:watch

Build the project using pnpm build.

To just build the docs run pnpm build docs

Readme

Keywords

none

Package Sidebar

Install

npm i @openfn/language-magpi

Weekly Downloads

2

Version

1.1.2

License

LGPLv3

Unpacked Size

73.7 kB

Total Files

10

Last publish

Collaborators

  • mtuchi
  • elias-ba
  • stuartc-openfn
  • taylordowns2000