Hi All,
Is there a way to compare the ids like PATs list with existing/required PATs list and delete through Workflow?
Goal is to schedule delete only newly created PATs comparing required PATs list.
Hi All,
Is there a way to compare the ids like PATs list with existing/required PATs list and delete through Workflow?
Goal is to schedule delete only newly created PATs comparing required PATs list.
Hi @Prashanth1812,
You can try using a define variable operator with all the list of required PAT ID’s in a comma separated format.
Hi Jesvin,
Thanks for the response.
I’m doing the same thing but i see error: “error”: "task failed: activity error Unable to parse input as JSON, please ensure it is syntactically correct. (type: Error Parsing Input, retryable: false): invalid character ‘c’ in exponent of numeric literal (type: Error Parsing Input, retryable: false): Unable to parse input as JSON, please ensure it is syntactically correct.
Can you share your WF here.
Sure @jesvin90 , here it is
{
"name": "TEST PAT WF",
"description": "",
"modified": "2024-10-22T17:04:18.871338034Z",
"modifiedBy": {
"type": "IDENTITY",
"id": "xxx",
"name": "xxx"
},
"definition": {
"start": "HTTP Request",
"steps": {
"End Step - Success": {
"displayName": "",
"type": "success"
},
"HTTP Request": {
"actionId": "sp:http",
"attributes": {
"authenticationType": "OAuth",
"jsonRequestBody": null,
"method": "get",
"oAuthClientId": "xxx",
"oAuthClientSecret": "xxx",
"oAuthCredentialLocation": "oAuthInHeader",
"oAuthScope": null,
"oAuthTokenUrl": "xxx",
"requestContentType": null,
"requestHeaders": {
"Accept": "application/json"
},
"url": "https://xxx/beta/personal-access-tokens?"
},
"displayName": "",
"nextStep": "Loop",
"type": "action",
"versionNumber": 2
},
"Loop": {
"actionId": "sp:loop:iterator",
"attributes": {
"context.$": "$.hTTPRequest.body[*].id",
"input.$": "$.hTTPRequest.body[*].id",
"start": "Define Variable",
"steps": {
"Compare Strings": {
"choiceList": [
{
"comparator": "StringMatches",
"nextStep": "End Step - Success 1",
"variableA.$": "$.loop.loopInput",
"variableB.$": "$.defineVariable.patList"
}
],
"defaultStep": "Define Variable 2",
"displayName": "",
"type": "choice"
},
"Define Variable": {
"attributes": {
"id": "sp:define-variable",
"variables": [
{
"description": "",
"name": "PatList",
"transforms": [],
"variableA": "\"pat1,pat2,pat3,pat4,pat5\""
}
]
},
"displayName": "",
"nextStep": "Compare Strings",
"type": "Mutation"
},
"Define Variable 1": {
"attributes": {
"id": "sp:define-variable",
"variables": [
{
"description": "",
"name": "request url with id",
"transforms": [
{
"id": "sp:transform:concatenate:string",
"input": {
"variableB.$": "$.defineVariable2.id"
}
},
{
"id": "sp:transform:concatenate:string",
"input": {
"variableB.$": "$.defineVariable2.id"
}
}
]
}
]
},
"displayName": "",
"nextStep": "HTTP Request 1",
"type": "Mutation"
},
"Define Variable 2": {
"attributes": {
"id": "sp:define-variable",
"variables": [
{
"description": "",
"name": "id",
"transforms": [],
"variableA.$": "$.loop.loopInput"
}
]
},
"displayName": "",
"nextStep": "Define Variable 3",
"type": "Mutation"
},
"Define Variable 3": {
"attributes": {
"id": "sp:define-variable",
"variables": [
{
"description": "",
"name": "Req url",
"transforms": [],
"variableA": "https://xxx/beta/personal-access-tokens/"
}
]
},
"displayName": "",
"nextStep": "Define Variable 1",
"type": "Mutation"
},
"End Step - Success 1": {
"displayName": "",
"type": "success"
},
"HTTP Request 1": {
"actionId": "sp:http",
"attributes": {
"authenticationType": "OAuth",
"jsonRequestBody.$": "$.defineVariable2.id",
"method": "delete",
"oAuthClientId": "xxx",
"oAuthClientSecret": "xxx",
"oAuthCredentialLocation": "oAuthInHeader",
"oAuthTokenUrl": "https://xxx/oauth/token",
"requestContentType": "json",
"requestHeaders": {
"Accept": "application/json"
},
"url.$": "$.defineVariable1.requestUrlWithId",
"urlParams": null
},
"displayName": "",
"nextStep": "End Step - Success 1",
"type": "action",
"versionNumber": 2
}
}
},
"displayName": "",
"nextStep": "End Step - Success",
"type": "action",
"versionNumber": 1
}
}
},
"creator": {
"type": "IDENTITY",
"id": "xxx",
"name": "xxx"
},
"trigger": {
"type": "SCHEDULED",
"attributes": {
"cronString": "0 2 * * 0",
"frequency": "weekly",
"timeZone": "America/New_York",
"weeklyDays": [
"Sunday"
],
"weeklyTimes": [
"1969-12-31T07:00:00.000Z"
]
}
}
}
Hi @Prashanth1812,
Try with loop input as - $.hTTPRequest.body
and in the compare strings, use $.loop.loopInput.id
Also, in the compare operator, use $.defineVariable.patList as Value 1
sure thanks @jesvin90 , will try and update here.
Same error @jesvin90
"type": "ChildWorkflowExecutionFailed",
"timestamp": "2024-10-23T19:22:22.179358522Z",
"attributes": {
"error": "task failed: activity error (type: sp:external:http:v2, scheduledEventID: 35, startedEventID: 36, identity: 1@sp-workflow-worker-stg-us-east-1-7b6d4548f4-kjrpl@): Unable to parse input as JSON, please ensure it is syntactically correct. (type: Error Parsing Input, retryable: false): invalid character 'c' after top-level value (type: Error Parsing Input, retryable: false): Unable to parse input as JSON, please ensure it is syntactically correct. (type: Error Parsing Input, retryable: false): invalid character 'c' after top-level value (type: SyntaxError, retryable: true)"
Thanks @jesvin90
Now this is working,
{
"name": "TEST PAT WF",
"description": "",
"modified": "2024-10-23T19:48:15.641320728Z",
"modifiedBy": {
"type": "IDENTITY",
"id": "xxx",
"name": "xxx"
},
"definition": {
"start": "HTTP Request",
"steps": {
"End Step - Success": {
"displayName": "",
"type": "success"
},
"HTTP Request": {
"actionId": "sp:http",
"attributes": {
"authenticationType": "OAuth",
"jsonRequestBody": null,
"method": "get",
"oAuthClientId": "xxx",
"oAuthClientSecret": "xxx",
"oAuthCredentialLocation": "oAuthInHeader",
"oAuthScope": null,
"oAuthTokenUrl": "https://xxx/oauth/token",
"requestContentType": null,
"requestHeaders": {
"Accept": "application/json"
},
"url": "https://xxx/beta/personal-access-tokens?"
},
"displayName": "",
"nextStep": "Loop",
"type": "action",
"versionNumber": 2
},
"Loop": {
"actionId": "sp:loop:iterator",
"attributes": {
"context.$": "$.hTTPRequest.body[*].id",
"input.$": "$.hTTPRequest.body[*].id",
"start": "Define Variable",
"steps": {
"Compare Strings": {
"choiceList": [
{
"comparator": "StringMatches",
"nextStep": "End Step - Success 1",
"variableA.$": "$.defineVariable.patList",
"variableB.$": "$.loop.loopInput"
}
],
"defaultStep": "Define Variable 2",
"displayName": "",
"type": "choice"
},
"Define Variable": {
"attributes": {
"id": "sp:define-variable",
"variables": [
{
"description": "",
"name": "PatList",
"transforms": [],
"variableA": "\"id1,id2,id3,id4,\""
}
]
},
"displayName": "",
"nextStep": "Compare Strings",
"type": "Mutation"
},
"Define Variable 1": {
"attributes": {
"id": "sp:define-variable",
"variables": [
{
"description": "",
"name": "urlID",
"transforms": [
{
"id": "sp:transform:concatenate:string",
"input": {
"variableB.$": "$.defineVariable2.id"
}
}
],
"variableA.$": "$.defineVariable3.reqUrl"
}
]
},
"displayName": "",
"nextStep": "HTTP Request 1",
"type": "Mutation"
},
"Define Variable 2": {
"attributes": {
"id": "sp:define-variable",
"variables": [
{
"description": "",
"name": "id",
"transforms": [],
"variableA.$": "$.loop.loopInput"
}
]
},
"displayName": "",
"nextStep": "Define Variable 3",
"type": "Mutation"
},
"Define Variable 3": {
"attributes": {
"id": "sp:define-variable",
"variables": [
{
"description": "",
"name": "Req url",
"transforms": [],
"variableA": "https://xxx/beta/personal-access-tokens/"
}
]
},
"displayName": "",
"nextStep": "Define Variable 1",
"type": "Mutation"
},
"End Step - Success 1": {
"displayName": "",
"type": "success"
},
"HTTP Request 1": {
"actionId": "sp:http",
"attributes": {
"authenticationType": "OAuth",
"method": "delete",
"oAuthClientId": "xxx",
"oAuthClientSecret": "xxx",
"oAuthCredentialLocation": "oAuthInHeader",
"oAuthTokenUrl": "https://xxx/oauth/token",
"requestContentType": null,
"requestHeaders": {
"Accept": "application/json"
},
"url.$": "$.defineVariable1.urlID",
"urlParams": null
},
"displayName": "",
"nextStep": "End Step - Success 1",
"type": "action",
"versionNumber": 2
}
}
},
"displayName": "",
"nextStep": "End Step - Success",
"type": "action",
"versionNumber": 1
}
}
},
"creator": {
"type": "IDENTITY",
"id": "363c8aedf38544baa18cc2ac622ab443",
"name": "adm-Prashanth Pullammagari"
},
"trigger": {
"type": "SCHEDULED",
"attributes": {
"cronString": "0 2 * * 0",
"frequency": "weekly",
"timeZone": "America/New_York",
"weeklyDays": [
"Sunday"
],
"weeklyTimes": [
"1969-12-31T07:00:00.000Z"
]
}
}
}
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.