Question
· Oct 3, 2018

CreateProperty with curl

Hello,

I have a question about creating properties with curl.

I already did create properties in Java with the following command.

<DO db.%CreateProperty("TotalSteps","%Integer","$.TotalSteps")>

It created the property TotalSteps with the type %Integer and the data path $.TotalSteps (since the header of my data source is also TotalSteps).

Now I would like to create the same property in curl with the following command

<curl -i -X POST -H "Content-Type: application/json" http://localhost:53774/api/docdb/v1/namespaceName/prop/databaseName/ propertyName?type= propertyType& path= propertyPath& unique=propertyUnique>

Port: 52773

namespaceName: fitnessnamespace

databaseName: teststream

propertyName: TotalSteps

propertyType: %Integer

propertyPath: ???

I need to insert the propertyPath like I did in the java code with "$.TotalSteps". The header from my data source is also called Kalorien. So how can I insert the propertyPath since "$.TotalSteps" doesn't work in curl?

Thank you in advance :)

Discussion (2)0
Log in or sign up to continue

Tuan,

$.TotalSteps seem to work OK in curl:

C:\utl>curl -i -X POST -H "Content-Type: application/json" http://localhost:52774/api/docdb/v1/USER/db/TestDB
HTTP/1.1 201 Created
...

{"content":{"Name":"TestDB","Class":"ISC.DM.TestDB","properties":[{"Name":"%%OID","Type":"%Library.RawString"},{"Name":"%Concurrency","Type":"%Library.RawString"},{"Name":"%Doc","Type":"%Library.DynamicAbstractObject"},{"Name":"%DocumentId","Type":"%Library.Integer"},{"Name":"%LastModified","Type":"%Library.UTC"}]}}


C:\utl>curl -i -X POST -H "Content-Type: application/json" http://localhost:52774/api/docdb/v1/USER/prop/TestDB/TotalSteps?type=%Integer&path=$.TotalSteps
HTTP/1.1 201 Created
...

{"content":{"Name":"TotalSteps","Type":"%Library.Integer"}}

What error do you get?

Hi Alexander,

Sorry for my bad english. After executing the code the property is defined. My problem is now that when I import my JSON data which looks like this:
 

{
  "entry": [
 {
   "Datum": "08-05-2015",
   "Kalorien": 1934,
   "Schritte": 905,
   "Distanzinm": "0,65",
   "Stockwerke": 0,
   "Aktivitaetsitzendinmin": 1355,
   "Aktivitaetleichtinmin": 46,
   "Aktivitaetmoderatinmin": 0,
   "Aktivitaetintensivinmin": 0,
   "LeistungsumsatzinKalorien": 168

]

It only saves the data as %DOC as shown in the picture,  but I want it to save it as the header "Kalorien". So after creating the property and importing the data is should be saved as "Kalorien" aswell or am I wrong?