This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Creating objects in the REST API

Hi everyone. 

I'm having some trouble with the REST API. I'm getting an error I can't seem to figure out.
When I try to create an object, no matter what exactly the type or class is, I get an 500 error with code 154 in the text and also: 'Wrong data type for property definition "Name".'

My input payload is as follows:

{"PropertyValues":
           [{"PropertyDef": 0, "TypedValue": { "DataType": 1, "Value": 'test'}}
           ,
            {"PropertyDef ":  100,"TypedValue":{"DataType":9,"Lookup":{"Item":0,"Version":-1}}}]}
As far as I can see the DataType : 1 is correct for Property 0, which is the built-in property Name.
Does anyone know what this might cause this?
Parents
  • Hey mate,

    There is a space after propertydef in the quotations for the class section, once i removed that your call worked.

    {
        "PropertyValues": [
            {
                "PropertyDef": 0,
                "TypedValue": {
                    "DataType": 1,
                    "Value": 'test'
                }
            },
            {
                "PropertyDef": 100,
                "TypedValue": {
                    "DataType": 9,
                    "Lookup": {
                        "Item": 0,
                        "Version": -1
                    }
                }
            }
        ]
    }

Reply
  • Hey mate,

    There is a space after propertydef in the quotations for the class section, once i removed that your call worked.

    {
        "PropertyValues": [
            {
                "PropertyDef": 0,
                "TypedValue": {
                    "DataType": 1,
                    "Value": 'test'
                }
            },
            {
                "PropertyDef": 100,
                "TypedValue": {
                    "DataType": 9,
                    "Lookup": {
                        "Item": 0,
                        "Version": -1
                    }
                }
            }
        ]
    }

Children