How to create a CKReference via CK Web Services?

I've using CK Web services very successfully, but I am stumpted about how to cerate a CKReference.


I've looked at the docs here re Reference Dictionaries, but can't make such a dictionary work.


My php generates the following operations dictionary:


{"operations":[

{"operationType": "create",

"record": { "recordType": "Works",

"fields": {

"type":{"value":"Painting"},

"title": {"value":"test"},

"date": {"value":"10/29/1965"},

"height": {"value":"21"},

"length": {"value":"21"},

"width": {"value":"21"},

"runningTime": {"value":""},

"materials": {"value":"test"},

"description":{"value":"test"},

"saleStatus": {"value":"yes"},

"tos":{"value":"yes"},

"artist": {"value":"Peter Wiley"},

"artistRecordName":{"value":"286CB3BF-69CC-4DD3-9233-CC80E5FA95D4"},

"artistRecordRef": {

"recordName": {"value":"286CB3BF-69CC-4DD3-9233-CC80E5FA95D4"},

"zoneID":{"zoneName": {"value":"_defaultZone"}},

"action": {"value":"NONE"}

},

"subject":{"value":""},

"metaType":{"value":"Fine Art"},

"userRecordName":{"value":"30C54AD8-3701-428C-99B7-0393DD2DAB45"},

"userRole":{"value":"Artist"},

"status":{"value":"P"}

}

} }

]}


This request returns the error: BAD_REQUEST" [1]=> string(62) "BadRequestException: Unexpected input at [line: 26, column: 3]


If I remove the "artistRecordRef" the request works as it should.


I am sure the answer is obvious to a more experienced eye. Can someone see what's wrong?

Answered by prwiley in 246692022

This is how one does it:


"artistRecordRef": {"value": {

"recordName": "'.$artistRecordName.'",

"action": "NONE"

}

},


The Reference Dictoionary has to be passed as a CK value. $artistRecordName is the php variable holding the recordName string.

Accepted Answer

This is how one does it:


"artistRecordRef": {"value": {

"recordName": "'.$artistRecordName.'",

"action": "NONE"

}

},


The Reference Dictoionary has to be passed as a CK value. $artistRecordName is the php variable holding the recordName string.

How to create a CKReference via CK Web Services?
 
 
Q