In [1]:
from memair import Memair
# Use Otto the sandbox user's access token or create your own at https://memair.com/temporary_access_token
access_token = '0000000000000000000000000000000000000000000000000000000000000000'

user = Memair(access_token)
In [3]:
# a Bulk Create can accept up to 50,000 records per request. They are processed in the background
response = user.query('''
mutation {
  Create(
    biometrics: [
      {type: systolic_pressure, value: 80},
      {type: diastolic_pressure, value: 120},
      {type: weight, value: 80}
    ]
    locations: [
      {lat: 42, lon: 42}
    ]
  )
  {
    id
    records_total
  }
}
''')

bulk_id = response['data']['Create']['id']
response
Out[3]:
{'data': {'Create': {'id': '46595', 'records_total': 4}}}
In [4]:
# You can monitor the progress of your Bulk Create using the Bulk Create Status endpoint
response = user.query('''
  query {
    CreateStatus(
      id: %s
    )
      {
        records_processed
        records_total
        has_finished
        finished_at
      }
    }
''' % (bulk_id))

response
Out[4]:
{'data': {'CreateStatus': {'records_processed': 4,
   'records_total': 4,
   'has_finished': True,
   'finished_at': '2019-05-28T17:02:04Z'}}}
In [ ]: