It's fairly easy to send data to Plecto, but before you send any data you must create your data structure in Plecto as what we call a "data source". A data source in Plecto is roughly equivalent to a database table, where you can create multiple columns - however, we do have some standard fields you must provide.

STANDARD FIELDS

data_source_uuid
uuid
The UUID of the Plecto data source

external_id
string, unique
A unique identifier for the item you are sending

member_api_id

string
A unique identifier for the person you are sending data for

member_api_provider
string
A unique identifier (string) for the system the above ID originates from

member_name

string
The name of the person associated with the item you are sending

team

uuid, optional
Optional reference to Team

date

string, ISO8601, optional
Should be the creation date of the item you are sending. If you have multiple dates, add them as a field in the data source inside Plecto.

HEADERS

The following header is required:

  • Content-Type: application/json

The following two headers should be set to identify your system. 

  • X-Integration: name of your system/product or company name.
  • X-Company: The name of the company you are sending the request for or the same as above when sending requests on behalf of yourself.

Example:

I have a company called "mycompany" and i have two clients "Alice" and "Bob" which i have made a integration to Plecto for. So whenever I send data it should include:
X-integration: mycompany ;

and when I send data for alice i would also include
X-Company: Alice

and when I send data for bob:
X-Company: Bob

Code example:

import requests
import json

r = requests.post('https://app.plecto.com/api/v2/registrations/', json.dumps([{
        'data_source': '<Data Source UUID>',
        'member_api_provider': 'internal-db',
        'member_api_id': '56165157',
        'member_name': 'Hans Christian Andersen',
        'team': '<Team UUID>',
        'date': '2012-13-13T00:00:00',
        'external_id': '1231231231'
    },{
        'data_source': '<Data Source UUID>',
        'member_api_provider': 'internal-db',
        'member_api_id': '56165157',
        'member_name': 'Hans Christian Andersen',
        'date': '2012-13-13T00:00:00',
        'external_id': '1231231232'
    }]),
    headers={'content-type': 'application/json', 'accept': 'application/json', 'X-Integration': 'mycompany', 'X-Company': 'Alice'},
    auth=('username@domain.com', 'password')
)

assert r.status_code == 200, "API Error: %s" % r.text
Did this answer your question?