This is a migrated thread and some comments may be shown as answers.

Loading data via the REST API

1 Answer 155 Views
REST API
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brad
Top achievements
Rank 1
Brad asked on 13 Feb 2014, 04:17 AM
I have a dataset of about 14000 records that I'd like to load.  What is the preferred method of doing this?  I've tried, but failed via the REST API.  Via Postman (in the Chrome App Store), I paired the data set down to around 1000 records, and I get success back, but it has only created a single empty record.  I've converted the data to JSON.  This is all very new to me, so any help is appreciated.  Here's a sample request.  

POST /v1/jRErONQZGxC1gQpV/ICDCode HTTP/1.1
Host: api.everlive.com
Cache-Control: no-cache

{ "Code":"0010", "Description":"Cholera due to vibrio cholerae", "ShortDescription":"Cholera d/t vib cholerae" }

Here's the result.  Keep in mind a record gets created, but the code, description, and shortdescription are not set.  If I have multiple objects in the JSON, again a single record gets created, but there aren't any values set.

{
    "Result": {
        "Id": "d2c197f0-9464-11e3-b107-2fd03e2eb5dd",
        "CreatedAt": "2014-02-13T04:10:50.479Z"
    }
}




1 Answer, 1 is accepted

Sort by
0
Anton
Top achievements
Rank 1
answered on 13 Feb 2014, 05:36 PM
Hey Brad,

Personally, I have been using Fiddler and Postman to upload bulk data (it seems that Fiddler allows larger JSON objects) and it worked perfectly. When uploading multiple records in your content type you must specify an array that contains all JSON records as outlined here.

I have been uploading w/o hassle through a POST call ~ 1200 items (Fiddler), ~ 500 (Postman). The numbers w/ Postman are relatively smaller due to some restrictions for the JSON content length in this tool.

Regarding the second part of your question, a success result will return you the Id(s) of the created item(s) and this is
created in the backend. In the data browser of your "ICDCode" content type there is a grid and also a detail view (a pane in the right part of the window) that shows details when a record in the grid is selected. To see not only the predefined fields in the grid define the structure of your content type by choosing it and pointing the 'Structure' tab in the right corner of the UI. Now add fields that match the fields "Code", "Description", etc., and the Backend Services will map the JSON data with this structure. Otherwise the data is still explorable but only when you select a single item - in the right pane you will see its details as an expanded JSON object (w/ very handy editor) and a message similar to "Fields that are not defined in the structure...".

I hope that this information will help you get started.

Cheers,
Tony
Tags
REST API
Asked by
Brad
Top achievements
Rank 1
Answers by
Anton
Top achievements
Rank 1
Share this question
or