Skip to main content

How to update Context Value using API

  • Oct 29, 2024 12:27 PM UTC
  • 10 replies
  • 184 views

skadav
Forum|alt.badge.img+10

Looking for updating Context Values using API just like an Action - Set Context Value.

10 replies

ipninichuck
Staff
Forum|alt.badge.img+6

Hello, so unfortunately this is not a documented API call. Reference the Swagger doc that is available on all instances for the official API. Saying that, you can use developer tools on your browser to determine what API endpoint is being called and more importantly what the payload is. I did this with a manual action that adds a new context value.Basically I opened dev tools when making the manual action. 


SoarAndy
Forum|alt.badge.img+12
  • Bronze 1
  • Nov 8, 2024 12:26 PM UTC

Set Context value - this should overwrite/update the existing value. Is that what you're after?


skadav
Forum|alt.badge.img+10
  • Author
  • Silver 2
  • Nov 11, 2024 3:19 PM UTC

Hello, so unfortunately this is not a documented API call. Reference the Swagger doc that is available on all instances for the official API. Saying that, you can use developer tools on your browser to determine what API endpoint is being called and more importantly what the payload is. I did this with a manual action that adds a new context value.Basically I opened dev tools when making the manual action. 


@ipninichuck  Thanks for this insight. Could you please help me better understand the payload structure? I’m seeing a lot of information, and I'm a bit confused about how to format the POST method correctly. Any guidance would be greatly appreciated.


skadav
Forum|alt.badge.img+10
  • Author
  • Silver 2
  • Nov 11, 2024 3:21 PM UTC

Set Context value - this should overwrite/update the existing value. Is that what you're after?


@SoarAndy  Yes, but by using API. So I can use HTML Widget to modify ContextValues on the fly.


ipninichuck
Staff
Forum|alt.badge.img+6

Hello skadav,

Thanks for the follow-up on your question. I'm ooo but I'll get back to this for you once I'm back. If Andy beats me to it all the better, otherwise I'll sort the answer for you.

 


skadav
Forum|alt.badge.img+10
  • Author
  • Silver 2
  • Dec 1, 2024 10:39 AM UTC

@ipninichuck  @SoarAndy  can you please help me.

Below details I am able to capture:
Request URL: https://XXXXXXXXX.siemplify-soar.com/api/external/v1/cases/ExecuteManualAction?format=camel


Payload: 

{alertGroupIdentifiers: [,…], scope: "All entities", targetEntities: [], caseId: 9923,…}

actionName: "Tools_Set Context Value"

actionProvider: "Scripts"

alertGroupIdentifiers: [,…]

0: "RULE_RULE_NAME_DETECTION_MONITORINGQGp5E7Z5ngvXevbIMImaIjrXXXXZMagXXXy5CJ9CCFE=_1c2ad9df-e8b1-4df8-a956-d4640a6896d9"

caseId: 9923

isPredefinedScope: true

properties: {ScriptName: "Tools_Set Context Value",…}

IntegrationInstance: "52d7b3da-xxxx-xxxx-xxxx-a36827c3XXXX"

ScriptName: "Tools_Set Context Value"

ScriptParametersEntityFields: "{\\"Value\\":\\"Test\\",\\"Key\\":\\"InitialCaseType\\",\\"Scope\\":\\"Case\\"}"

scope: "All entities"

targetEntities: []

 


SoarAndy
Forum|alt.badge.img+12
  • Bronze 1
  • Dec 2, 2024 4:08 PM UTC

@ipninichuck  @SoarAndy  can you please help me.

Below details I am able to capture:
Request URL: https://XXXXXXXXX.siemplify-soar.com/api/external/v1/cases/ExecuteManualAction?format=camel


Payload: 

{alertGroupIdentifiers: [,…], scope: "All entities", targetEntities: [], caseId: 9923,…}

actionName: "Tools_Set Context Value"

actionProvider: "Scripts"

alertGroupIdentifiers: [,…]

0: "RULE_RULE_NAME_DETECTION_MONITORINGQGp5E7Z5ngvXevbIMImaIjrXXXXZMagXXXy5CJ9CCFE=_1c2ad9df-e8b1-4df8-a956-d4640a6896d9"

caseId: 9923

isPredefinedScope: true

properties: {ScriptName: "Tools_Set Context Value",…}

IntegrationInstance: "52d7b3da-xxxx-xxxx-xxxx-a36827c3XXXX"

ScriptName: "Tools_Set Context Value"

ScriptParametersEntityFields: "{\\"Value\\":\\"Test\\",\\"Key\\":\\"InitialCaseType\\",\\"Scope\\":\\"Case\\"}"

scope: "All entities"

targetEntities: []

 


 I used Chrome DevTools, then ran the "Set Context" Action and captured the payload

https://____.siemplify-soar.com/api/external/v1/cases/ExecuteManualAction?format=camel

{"alertGroupIdentifiers":["IT_Threat Intelligence_TI map Domain entity to Syslog_May2024odqB87BHi4epKn26T38+oSy1FO+xCbzkbtJ1FOkcg3o=_e512dcde-9e77-4e02-8a52-5ab67197b172"],"scope":"All entities","targetEntities":[],"caseId":1405,"actionName":"Tools_Set Context Value","actionProvider":"Scripts","properties":{"ScriptName":"Tools_Set Context Value","ScriptParametersEntityFields":"{\\"Value\\":\\"myValue\\",\\"Key\\":\\"myKey\\",\\"Scope\\":\\"Case\\"}","IntegrationInstance":"bc0dae37-82dd-4a1f-8cfd-e4873f0a566b"},"isPredefinedScope":true}

 

LMK 🙂

grace01
Forum|alt.badge.img+1
  • New Member
  • Dec 10, 2024 8:54 PM UTC
 I used Chrome DevTools, then ran the "Set Context" Action and captured the payload

https://____.siemplify-soar.com/api/external/v1/cases/ExecuteManualAction?format=camel

{"alertGroupIdentifiers":["IT_Threat Intelligence_TI map Domain entity to Syslog_May2024odqB87BHi4epKn26T38+oSy1FO+xCbzkbtJ1FOkcg3o=_e512dcde-9e77-4e02-8a52-5ab67197b172"],"scope":"All entities","targetEntities":[],"caseId":1405,"actionName":"Tools_Set Context Value","actionProvider":"Scripts","properties":{"ScriptName":"Tools_Set Context Value","ScriptParametersEntityFields":"{\\"Value\\":\\"myValue\\",\\"Key\\":\\"myKey\\",\\"Scope\\":\\"Case\\"}","IntegrationInstance":"bc0dae37-82dd-4a1f-8cfd-e4873f0a566b"},"isPredefinedScope":true}

 

LMK 🙂

Hi I am having this same issue. I captured the payload in the same way but when trying to run the POST method, I get a 400 error every time. Can you show an example of this API action working within the IDE, rather than just via the manual action button? Not sure what about the payload is malformed.


SoarAndy
Forum|alt.badge.img+12
  • Bronze 1
  • Dec 11, 2024 9:57 AM UTC

Hi I am having this same issue. I captured the payload in the same way but when trying to run the POST method, I get a 400 error every time. Can you show an example of this API action working within the IDE, rather than just via the manual action button? Not sure what about the payload is malformed.


I just copied and pasted the above into my postman and it worked first time

Auth

Manual Action audit on the case wall


I then did a 'Case Comment' to prove the value of it

HTH

 


skadav
Forum|alt.badge.img+10
  • Author
  • Silver 2
  • Dec 26, 2024 8:54 AM UTC

I just copied and pasted the above into my postman and it worked first time

Auth

Manual Action audit on the case wall


I then did a 'Case Comment' to prove the value of it

HTH

 


Hello @SoarAndy 

Thank you. This worked for me on Postman as well.

can you please guide how I can get below highlighted value dynamically? I tried to search key in context value which can give me this value, but unable to find the same.

Thanks,
Suraj Kadav