Important Update: Some Community URL Redirects are Under Maintenance. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

How Do i Unlink a record using REST API ?

hackmaster
Contributor II

Hello Team i am looking for a way i could unlink a record using REST API. Do you know which REST API function i would need to use to accomplish the same.

I have attached a screen shot. I would like to simulate removing those marked , using a rest API.

hackmaster_0-1651124338425.png

I tried using the DELETE. I think that does not simulate unlinking a record. Invoke-RestMethod -Method DELETE -Uri $api_url -Headers $headers -ContentType "application/json" -WebSession $sess

1 ACCEPTED SOLUTION

Accepted Solutions

Anonymous
Not applicable

@hackmaster,

There is no unmap or map API verb or method. You just update record and provide all records to be mapped. Like overriding. CR is type = 9, check what @JeffLetterman provided:

https://www.archerirm.community/t5/discussions/when-creating-updating-records-via-rest-api-what-is-the-json/m-p/431991#M14393

 

View solution in original post

5 REPLIES 5

Anonymous
Not applicable

@hackmaster,

There is no unmap or map API verb or method. You just update record and provide all records to be mapped. Like overriding. CR is type = 9, check what @JeffLetterman provided:

https://www.archerirm.community/t5/discussions/when-creating-updating-records-via-rest-api-what-is-the-json/m-p/431991#M14393

 

@Anonymous  Thank you Very much. If i understand it correctly. I Have to use a Post Method to update the respective cross reference field with the desired ID's ?

Anonymous
Not applicable

Well POST or PUT, it is defined in the respective API guideline, but the approach is UPDATE.

hackmaster
Contributor II

I am trying to update the info but i am getting an error "The remote server returned an error: (400) Bad Request"

I get the same error with POST or PUT. Would you be able to tell me what i am doing incorrectly ?

Here is the code i am trying to use

$api_url = $base_url + "/api/core/content"

$body = '
"4973": {
"Type": 9,
"Value": [
{
"ContentId": 4454091
},
{
"ContentId": 4454097
},
{
"ContentId": 4454082
}
],
"FieldId": 4973
} '

$results = Invoke-RestMethod -Method POST -Uri $api_url -Body $body -Headers $headers -ContentType "application/json" -WebSession $sess

Anonymous
Not applicable

To see correct API call and test it, I recommend the splendid tool @JeffLetterman crafted for all of us:

https://www.archerirm.community/t5/tkb/articleprintpage/tkb-id/exchange-overviews/article-id/256