0

I'm using Archer REST API to upload a new attachment.
After i'm uploaded the attachment i have a File Id, now i'm trying to update field of the record with the new attachment, what i'm trying in the request body:

{"Content":{"Id": 278800, "LevelId" : 222,"FieldContents" : {"21771" : {"Type" : 11, "Value" : {"File id" : "1738", "Value": "RestUpload.xml"}, "FieldId" : 21771}, "16108" : {"Type" : 1, "Value" : "RestAPI Text x3", "FieldId" : 16108}}

I got the following result:

{
"Links": [],
"RequestedObject": {
    "Id": 278800
},
"IsSuccessful": true,
"ValidationMessages": []
}

But only the Text field updated.
What i need to fix?
Thanks.

CSharpBeginner
  • 601
  • 2
  • 7
  • 22

1 Answers1

1

The easiest way to see how to format a field in a PUT or POST is to make a GET call and look at how the field is formatted in the response. In this case, your request body should look like this:

{"Content":{"Id": 213726 , "LevelId" : 255,"FieldContents" : {"16751": {"Type" : 11, "Value" : [11,3], "FieldId": 16751}}}}

Note that the list of file IDs attached to this record is an array, and must be represented as a comma-delimited list of ids in contained in square brackets.

bodie
  • 71
  • 3
  • Hi, i'm tried your body but it's still not success.. instead of [11,3] i need to replace with my file id? – CSharpBeginner Jul 22 '16 at 11:26
  • Yes, correct. Put a coma- separated list of file ids in square brackets to represent an array in JSON. If there is an attachment already on the record, be sure to include that id, or it will no longer be attached after your update. – bodie Jul 23 '16 at 13:49
  • Hi, i'm tried to write like that: "16751": {"Type" : 11, "Value" : [1730], "FieldId": 16751} when 1730 is my file id, this field is attachment type but its not worked for me.. – CSharpBeginner Jul 23 '16 at 21:11
  • You will need to use your own IDs in place of mine. I'll post the string again with placeholders to make it a bit more clear where you need to put your IDs. `{"Content":{"Id": YOUR_CONTENT_ID, "LevelId" : YOUR_LEVEL_ID,"FieldContents" : {"YOUR_FIELD_ID": {"Type" : 11, "Value" : [YOUR_FILE_IDS_IN_COMMA_SEPARATED_LIST], "FieldId": YOUR_FIELD_ID}}}}` – bodie Jul 25 '16 at 23:01
  • Hi, i have been tried exactly like you said and still now worked for me – CSharpBeginner Jul 27 '16 at 08:28
  • @bodie cna you please explain what level-id does or help in ?? and these GUID's(YOUR_CONTENT_ID) are same for all the RSA instance or I've program it differently for each RSAacher instance ? It'll be of great help, if you can answer these two question – Sumit Murari Feb 07 '17 at 01:26
  • Back in the day (Archer 4.x) applications only had a level associated with them if they were multi-leveled. Since the days of 5.x, even single-leveled applications have a level. Thus, Applications contain levels, which contain fields. The LevelId in the JSON you send has to be in agreement with the level that contains the fields you are setting. GUIDs will match between environments for out-of-the-box entities like applications and fields. GUIDs associated with content records will be unique to each environment. – bodie Feb 13 '17 at 14:58