0

I use the Workflow History List for debugging and the option of turning on debugging for flows that are in production. I would however like a workflow that purges the records in this list based by the workflow Name. I have created a workflow and a Delete HTTP request, but can't get it to work. I can't find any documentation on how to do this. What I have is

 [%Workflow Context:Current Site URL%]/_api/lists/GetByTitle('Workflow 

History')?$select=Id as my String in my Call

I get the following response code:

response=PreconditionFailed

I think I'm getting it, but still don't know how to put the pieces together. My understanding now is that I create a HTTP Rest to select the IDs of each record. Then I have to follow it with two more HTTP requests one to get the item and the other to delete the item. It is these later two that I don't know how to do. Am I on the right track?

1 Answer 1

0

Change the Request like below.

[%Workflow Context:Current Site URL%]/_api/lists/GetByTitle('Workflow%20History')/item(1)

The following example shows how to delete a list item.

url: http://site url/_api/web/lists/GetByTitle('Test')/items(item id)
method: POST
headers:
     Authorization: "Bearer " + accessToken
     X-RequestDigest: form digest value
    "IF-MATCH": etag or "*"
    "X-HTTP-Method":"DELETE"

You can refer to the article below to do a POST request using REST API in SharePoint designer.

SharePoint Designer 2013 Workflows and POST REST API

1
  • I understand that once I get the ID; then need to create a POST REST call, but though I am a seasoned programmer and I've written very sophisticated workflows in SharePoint, my experience with the REST operation is only GETS and I still have issues parsing multi-column attributes from custom lists. Your example seems concise and simple, I have no clue how to implement. I know I must create some dictionary fields and possible a single call statement, but that's it. I have looked at your reference, and based on my knowledge base, it doesn't help me. If you could spell it out more simply pls Commented May 24, 2019 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.