Adding Metadatabase Records

Add Metadatabase Record(s)

POST https://insight.plumvoice.com/api/metadatabase_push

Add metadatabase records to a Plum Insight survey.

Headers

NameTypeDescription

content-type

string

application/x-www-form-urlencoded

Request Body

NameTypeDescription

metadatabase

string

The name of the metadatabase. This is case-insensitive.

record

string

json encoded associative array of the column names and column values to be added. Example: {'column1': 'value1', 'column2': 'value2'} This need not include all columns, you can leave out columns in your metadatabase you do not wish to populate.

{'success':true}

Possible Response Codes

  • 200: success

  • 400: invalid data supplied

  • 401: authentication headers invalid or the account is inactive

  • 404: metadatabase was not found

  • 405: invalid HTTP method supplied (only POST allowed)

  • 415: unsupported media type (Content-Type value in request)

  • 500: database error

The return structure contains the following item(s):

Name

Data Type

Always Present

Description

success

boolean

yes

Indicates the outcome of the request

error

string

no

If the success value is false this provides a message indicating what error(s) occurred

Sample Code

This sample PHP code makes a request to push a new record into the 'test' metadatabase and sets values for columns column1 and column2:

<?php

$params = array(
	'metadatabase' => 'test',
	'record' => json_encode(array('column1' => 'value1', 'column2' => 'value2')),
	);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://insight.plumvoice.com/api/metadatabase_push");
curl_setopt($ch, CURLOPT_USERPWD, 'your_login:your_dev_pin'); // http basic auth credentials
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', 'Accept: application/json'));
$result = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
var_dump($http_code, $result);

Last updated