I'm trying to formulate the body of a put method to update contact attributes using REST, so far I have an xml string formatted like this:
string putBody = @"<cnt>" + "<billing_code>cost_cntr:1000072</billing_code>" + "</cnt>";
The call doesn't fail, the cost center field on the record just gets set to blank. This is the format that works with soap but I can't figure out how it needs to be modified to work with REST?
The line below works but that's updating a simple string attribute on the object itself not an SREL to another object.
//string putBody = @"<cnt>" + "<last_name>HelloWorld</last_name>" + "</cnt>";
Can someone point me in the right direction on handling SRELs with REST?
with this schema:
billing_code SREL -> cost_cntr.id
I think you should use
please also take a look at
Updating activity log for an incident through REST
I tried taking out the object reference as you mentioned but it still sets cost center to blank on the contact record.
I also noticed that I hadn't used the X-Obj-Attrs: header either so I added that in but still with no effect.
So I tried all 4 different combinations of the object reference and header but with no luck. Do I need to declare a type like your example shows in the other thread?
Elwynn, I don't think so...that is for BREL and this one is SREL. Let me see if I can find an env try to do a similar one there. Thanks _Chi
this one works for me:
I'm still trying to figure out how to get your example to work, can you give me a bit more of the code?
Also what tool where you using when you got the above format to work? I'm working with C# and can't figure out how to get double quotes within a string that already has double quotes.
Elwynn, I used java...and I constructed the variable as this:
PutMethod put = new PutMethod(endpointPUT); put.addRequestHeader("X-AccessKey", accessKey); put.addRequestHeader("Accept" , "application/xml"); put.addRequestHeader("Content-Type", "application/xml; charset=UTF-8"); put.setRequestBody( "<cnt>" + "<billing_code REL_ATTR=\"1000001\"/>" + "</cnt>" );
As for C#, I think you can do the same using \" to escape. Please take a look at C# in Depth: Strings in C# and .NET
I finally got it to work, by copying and pasting your code exactly.
Thanks for your help!