Unable to successfully migrate a project: TF201077: The work item type cannot be found - azure-devops-migration-tools

I've successfully migrated both stock and bespoke projects but I'm having trouble with one project I can't move based on the same config file (so it's probably not the config).
It looks like it's unable to save the work item. I've tried project to project in the same org using the same process, org to org, and removing any iterations. I just get the same error.
The work items I'm migrating are extremely basic tasks/stories with no bespoke fields populated.
I'm getting the following:
[11:33:24 ERR] Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemTypeDeniedOrNotExistException: TF201077: The work item type cannot be found. It may have been renamed or destroyed.
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.get_Type()
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemFieldData.Microsoft.TeamFoundation.WorkItemTracking.Internals.IWorkItemOpenFieldDataHelper.SetLatestData(Dictionary`2 latestData)
at Microsoft.TeamFoundation.WorkItemTracking.Internals.WorkItemHelper.LoadWorkItemFieldData(IRowSetCollectionHelper tables, IWorkItemOpenFieldDataHelper helper)
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.LoadWorkItemFromRowSetInternal(Int32 rev, Nullable`1 asof, IWorkItemRowSets witem)
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem..ctor(WorkItemStore store, Int32 id, Int32 revision)
at MigrationTools.TfsExtensions.GetRevision(WorkItemData context, Int32 rev) in D:\a\1\s\src\MigrationTools.Clients.AzureDevops.ObjectModel\TfsExtensions.cs:line 35
at VstsSyncMigrator.Engine.WorkItemMigrationContext.ReplayRevisions(List`1 revisionsToMigrate, WorkItemData sourceWorkItem, WorkItemData targetWorkItem) in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 600
and at the end:
[11:33:25 ERR] Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF237124: Work Item is not ready to save
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.Save(SaveFlags saveFlags)
at MigrationTools.TfsExtensions.SaveToAzureDevOps(WorkItemData context) in D:\a\1\s\src\MigrationTools.Clients.AzureDevops.ObjectModel\TfsExtensions.cs:line 76
at VstsSyncMigrator.Engine.WorkItemMigrationContext.ReplayRevisions(List`1 revisionsToMigrate, WorkItemData sourceWorkItem, WorkItemData targetWorkItem) in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 643
[11:33:25 INF] ===============================================================
[11:33:25 WRN] Work Item is not ready to save as it has some invalid fields. This may not result in an error. Enable LogLevel as 'Debug' in the config to see more.
[11:33:25 ERR] Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF237124: Work Item is not ready to save
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.Save(SaveFlags saveFlags)
at MigrationTools.TfsExtensions.SaveToAzureDevOps(WorkItemData context) in D:\a\1\s\src\MigrationTools.Clients.AzureDevops.ObjectModel\TfsExtensions.cs:line 76
at VstsSyncMigrator.Engine.WorkItemMigrationContext.<ProcessWorkItemAsync>d__35.MoveNext() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 486
Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF237124: Work Item is not ready to save
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.Save(SaveFlags saveFlags)
at MigrationTools.TfsExtensions.SaveToAzureDevOps(WorkItemData context) in D:\a\1\s\src\MigrationTools.Clients.AzureDevops.ObjectModel\TfsExtensions.cs:line 76
at VstsSyncMigrator.Engine.WorkItemMigrationContext.<ProcessWorkItemAsync>d__35.MoveNext() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 486
[11:33:25 ERR] Could not save migrated work item 35, an exception occurred.
System.AggregateException: One or more errors occurred. ---> Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF237124: Work Item is not ready to save
at VstsSyncMigrator.Engine.WorkItemMigrationContext.<ProcessWorkItemAsync>d__35.MoveNext() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 531
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at VstsSyncMigrator.Engine.WorkItemMigrationContext.InternalExecute() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 205
---> (Inner Exception #0) Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF237124: Work Item is not ready to save
at VstsSyncMigrator.Engine.WorkItemMigrationContext.<ProcessWorkItemAsync>d__35.MoveNext() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 531<---
[11:33:25 WRN] The following items could not be migrated: 35
[11:33:25 INF] DONE in 00:00:05.6093139
[11:33:25 FTL] Error while running WorkItemMigration
System.AggregateException: One or more errors occurred. ---> Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF237124: Work Item is not ready to save
at VstsSyncMigrator.Engine.WorkItemMigrationContext.<ProcessWorkItemAsync>d__35.MoveNext() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 531
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at VstsSyncMigrator.Engine.WorkItemMigrationContext.InternalExecute() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 225
at MigrationTools._EngineV1.Processors.MigrationProcessorBase.Execute() in D:\a\1\s\src\MigrationTools\_EngineV1\Processors\MigrationProcessorBase.cs:line 47
---> (Inner Exception #0) Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF237124: Work Item is not ready to save
at VstsSyncMigrator.Engine.WorkItemMigrationContext.<ProcessWorkItemAsync>d__35.MoveNext() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 531<---
[11:33:25 ERR] WorkItemMigration The Processor MigrationEngine entered the failed state...stopping run
[11:33:25 INF] Application is shutting down...
[11:33:25 INF] Terminating: Application forcebly closed.
[11:33:25 INF] Application Ending
[11:33:25 INF] The application ran in 00:00:10.7989077 and finished at 07/27/2022 11:33:25
The config is:
{
"ChangeSetMappingFile": null,
"Source": {
"$type": "TfsTeamProjectConfig",
"Collection": "https://dev.azure.com/XXXX/",
"Project": "XXXX",
"ReflectedWorkItemIDFieldName": "Custom.ReflectedWorkItemId",
"AllowCrossProjectLinking": false,
"AuthenticationMode": "AccessToken",
"PersonalAccessToken": "XXXXX",
"PersonalAccessTokenVariableName": "",
"LanguageMaps": {
"AreaPath": "Area",
"IterationPath": "Iteration"
}
},
"Target": {
"$type": "TfsTeamProjectConfig",
"Collection": "https://dev.azure.com/XXXX/",
"Project": "XXXX",
"ReflectedWorkItemIDFieldName": "Custom.ReflectedWorkItemId",
"AllowCrossProjectLinking": false,
"AuthenticationMode": "AccessToken",
"PersonalAccessToken": "XXXX",
"PersonalAccessTokenVariableName": "",
"LanguageMaps": {
"AreaPath": "Area",
"IterationPath": "Iteration"
}
},
"FieldMaps": [
],
"GitRepoMapping": null,
"LogLevel": "Information",
"CommonEnrichersConfig": null,
"Processors": [
{
"$type": "WorkItemMigrationConfig",
"Enabled": true,
"ReplayRevisions": true,
"PrefixProjectToNodes": false,
"UpdateCreatedDate": true,
"UpdateCreatedBy": true,
"WIQLQueryBit": "AND [Microsoft.VSTS.Common.ClosedDate] = '' AND [System.WorkItemType] NOT IN ('Test Suite', 'Test Plan','Shared Steps','Shared Parameter','Feedback Request')",
"WIQLOrderBit": "[System.ChangedDate] desc",
"LinkMigration": true,
"AttachmentMigration": true,
"AttachmentWorkingPath": "c:\\temp\\WorkItemAttachmentWorkingFolder\\",
"FixHtmlAttachmentLinks": false,
"SkipToFinalRevisedWorkItemType": true,
"WorkItemCreateRetryLimit": 5,
"FilterWorkItemsThatAlreadyExistInTarget": true,
"PauseAfterEachWorkItem": false,
"AttachmentMaxSize": 480000000,
"AttachRevisionHistory": false,
"LinkMigrationSaveEachAsAdded": false,
"GenerateMigrationComment": true,
"WorkItemIDs": null,
"MaxRevisions": 0,
"NodeStructureEnricherEnabled": null,
"UseCommonNodeStructureEnricherConfig": false,
"NodeBasePaths": [
"Product\\Area\\Path1",
"Product\\Area\\Path2"
],
"AreaMaps": {},
"IterationMaps": {},
"MaxGracefulFailures": 0
}
],
"Version": "12.0",
"workaroundForQuerySOAPBugEnabled": false,
"WorkItemTypeDefinition": {
"sourceWorkItemTypeName": "targetWorkItemTypeName"
},
"Endpoints": {
"InMemoryWorkItemEndpoints": [
{
"Name": "Source",
"EndpointEnrichers": null
},
{
"Name": "Target",
"EndpointEnrichers": null
}
]
}
}

Posting an answer in case anyone else had the same problem.
My issue was in the config file after all. It had example data under the node base paths:
"NodeBasePaths": [
"Product\\Area\\Path1",
"Product\\Area\\Path2"
],
and that prevented the node mapping which caused the save to fail and produced the error. Simply removing all data in that section if I'm not using it solved the problem.

Related

"transforms.Reroute.topic.regex" and "table.include.list" in property Json of Debezium SQL connector

``As per below property files, expected behavior is to route events from "table.include.list": "dbo.idm_assets,dbo.idm_datapoints" to queue - debezium_assets and from "table.include.list": "dbo.idm_workorder,dbo.idm_activity" to queue - debezium_events.`
`{
"name": "sql-server-kafkacdc-idm-connection",
"config": {
"snapshot.mode": "initial_schema_only",
"connector.class": "io.debezium.connector.sqlserver.SqlServerConnector",
"database.hostname": "localhost",
"database.port": "1433",
"database.user": "cdc_idm_owner",
"database.password": "cdcIdm#2022",
"database.dbname": "kafkacdc",
"database.server.name": "kafkacdc",
"tasks.max": "1",
"decimal.handling.mode": "string",
"tombstones.on.delete": false,
"table.include.list": "dbo.idm_assets,dbo.idm_datapoints",
"transforms": "Reroute",
"transforms.Reroute.type": "io.debezium.transforms.ByLogicalTableRouter",
"transforms.Reroute.topic.regex": "(.*)",
"transforms.Reroute.topic.replacement": "debezium_assets",
"database.history":"io.debezium.relational.history.MemoryDatabaseHistory"
}
}`
{
"name": "sql-server-kafkacdc-idm-all-001",
"config": {
"snapshot.mode": "initial_schema_only",
"connector.class": "io.debezium.connector.sqlserver.SqlServerConnector",
"database.hostname": "localhost",
"database.port": "1433",
"database.user": "cdc_idm_owner",
"database.password": "cdcIdm#2022",
"database.dbname": "kafkacdc",
"database.server.name": "kafkacdc",
"tasks.max": "1",
"decimal.handling.mode": "string",
"tombstones.on.delete": false,
"table.include.list": "dbo.idm_workorder,dbo.idm_activity",
"transforms": "Reroute",
"transforms.Reroute.type": "io.debezium.transforms.ByLogicalTableRouter",
"transforms.Reroute.topic.regex": "(.*)",
"transforms.Reroute.topic.replacement": "debezium_events",
"database.history":"io.debezium.relational.history.MemoryDatabaseHistory"
}
}
But currently, events are being sent to both the queues even if we trigger an event from table of another property file which isn't expected.
Observation : We have deleted one of the connectors(Assets) and tried to reproduce the issue. Triggered an event from Assets table and could see it in Events queue which is not expected.
Please find the current and expected behaviors:
Current Behavior
Expected Behavior`

Unable to correctly configure TeamSettingsProcessor

I am trying to figure out how to use the TeamSettingsProcessor to migrate teams between two Azure DevOps Server Projects. At first, I tried the configuration stated in the GitHub docs page:
{
"$type": "TeamMigrationConfig",
"Enabled": true,
"EnableTeamSettingsMigration": true,
"FixTeamSettingsForExistingTeams": true,
"PrefixProjectToNodes": false
}
That one simply returned:
[09:14:22 FTL] *************MIGRATION ALERT!!!!!!!!!
[09:14:22 FTL] TeamMigrationContext has been migrated to TfsTeamSettingsProcessor: https://nkdagility.github.io/azure-devops-migration-tools/Reference/Processors/TfsTeamSettingsProcessor.html"
So I switched to use the one referred to in the message (which apparently is in preview):
{
"$type": "TfsTeamSettingsProcessorOptions",
"Enabled": true,
"MigrateTeamSettings": true,
"UpdateTeamSettings": true,
"PrefixProjectToNodes": false,
"Teams": null,
"ProcessorEnrichers": null,
"Source": {
"$type": "TfsTeamSettingsEndpointOptions",
"Organisation": "https://company.com/tfs/Collection/",
"Project": "SourceProject",
"AuthenticationMode": "Prompt",
"ReflectedWorkItemIdField": "Custom.Field",
"LanguageMaps": {
"$type": "TfsLanguageMapOptions",
"AreaPath": "Area",
"IterationPath": "Iteration"
},
"EndpointEnrichers": null
},
"Target": {
"$type": "TfsTeamSettingsEndpointOptions",
"Organisation": "https://company.com/tfs/Collection/",
"Project": "TargetProject",
"AuthenticationMode": "Prompt",
"ReflectedWorkItemIdField": "Custom.Field",
"LanguageMaps": {
"$type": "TfsLanguageMapOptions",
"AreaPath": "Area",
"IterationPath": "Iteration"
},
"EndpointEnrichers": null
}
}
But that simply returns the error
[09:38:40 INF] Start Time: 02/09/2021 09:38:40
[09:38:40 INF] Running with args: execute
[09:38:40 INF] OSVersion: Microsoft Windows NT 6.2.9200.0
[09:38:40 INF] Version: 11.9.31.0
[09:38:48 INF] Latest version detected as 11.9.31.0
[09:38:48 DBG] Hosting starting
[09:38:48 INF] Application started. Press Ctrl+C to shut down.
[09:38:48 INF] Hosting environment: Production
[09:38:48 INF] Content root path: C:\git\DevIT\WorkItemMigration
[09:38:48 INF] Press Ctrl+C to shut down.
[09:38:48 DBG] Hosting started
[09:38:48 INF] Config Found, creating engine host
[09:38:49 INF] Creating Migration Engine 1fa254e5-abbf-4342-b1f0-1a72863f0b49
[09:38:49 INF] ProcessorContainer: Of 3 configured Processors only 1 are enabled
[09:38:49 INF] ProcessorContainer: Adding Processor TfsTeamSettingsProcessor
[09:38:49 INF] Processor::Configure
[09:38:49 ERR] Unhandled exception!
System.ArgumentNullException: Value cannot be null.
Parameter name: name
at MigrationTools.Endpoints.EndpointFactory.CreateEndpoint(String name) in D:\a\1\s\src\MigrationTools\Endpoints\EndpointFactory.cs:line 43
at MigrationTools.Processors.Processor.Configure(IProcessorOptions options) in D:\a\1\s\src\MigrationTools\Processors\Processor.cs:line 50
at MigrationTools.Processors.TfsTeamSettingsProcessor.Configure(IProcessorOptions options) in D:\a\1\s\src\MigrationTools.Clients.AzureDevops.ObjectModel\Processors\TfsTeamSettingsProcessor.cs:line 35
at MigrationTools._EngineV1.Containers.ProcessorContainer.Configure() in D:\a\1\s\src\MigrationTools\_EngineV1\Containers\ProcessorContainer.cs:line 61
at MigrationTools.MigrationEngine.Run() in D:\a\1\s\src\MigrationTools\MigrationEngine.cs:line 87
at MigrationTools.Host.ExecuteHostedService.<StartAsync>b__5_1() in D:\a\1\s\src\MigrationTools.Host\ExecuteHostedService.cs:line 38
I fail to see what parameter name that is missing?
I use their migrator quite often and I took a look into your issue.
I was able to replicate your issue exactly. When I dug into the exception, it looks like they changed their implementation of the TfsTeamSettingsProcessorOptions to not use the Source and Target nodes, despite this configuration being in their documentation.
What you'll need to do is update your TfsTeamSettingsProcessorOptions to point to named TfsEndpoints configured within the Endpoints array using SourceName and TargetName attributes.
It would look something like this in your case:
{
"$type": "TfsTeamSettingsProcessorOptions",
"Enabled": true,
"MigrateTeamSettings": true,
"UpdateTeamSettings": true,
"PrefixProjectToNodes": false,
"Teams": null,
"ProcessorEnrichers": null,
"SourceName": "Source",
"TargetName": "Target"
}

Migrating WorkItems that have no longer existing 'Team Project' references in their history fails

While migrating a project across two distinct Azure DevOps Organizations with the following config for the processor:
{
"ObjectType": "VstsSyncMigrator.Engine.Configuration.Processing.WorkItemMigrationConfig",
"Enabled": true,
"PrefixProjectToNodes": false,
"UpdateCreatedDate": true,
"UpdateCreatedBy": true,
"AppendMigrationToolSignatureFooter": false,
"LinkMigration": true,
"AttachmentMigration": true,
"AttachmentMazSize": 480000000,
"AttachmentWorkingPath": "c:\\temp\\WorkItemAttachmentWorkingFolder\\",
"FixHtmlAttachmentLinks": true,
"SkipToFinalRevisedWorkItemType": false,
"WorkItemCreateRetryLimit": 5,
"PauseAfterEachWorkItem": false,
"FilterWorkItemsThatAlreadyExistInTarget": false,
"BuildFieldTable": false,
"QueryBit": "AND [System.WorkItemType] NOT IN ('Test Suite', 'Test Plan') ",
"OrderBit": "[System.ChangedDate] desc",
"ReplayRevisions": true,
"CollapseRevisions": false
}
The process fails in the items that, in any of their revisions, reference Team Projects that no longer exist - those items were moved across projects within the same Organization in the past, and the originating project was in the meanwhile deleted.
[ User Story][Complete: 18/3284][sid:1471 |Rev:64 ][tid:null | Microsoft.TeamFoundation.WorkItemTracking.Client.DeniedOrNotExistException: TF26192: The team project specified by the ID 129 does not exist. Check the team project ID and try again.
at Microsoft.TeamFoundation.WorkItemTracking.Client.ProjectCollection.GetById(Int32 projectId)
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.CheckUpdateCachedData(Boolean projectChanged, Boolean typeChanged)
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.get_Type()
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemFieldData.Microsoft.TeamFoundation.WorkItemTracking.Internals.IWorkItemOpenFieldDataHelper.SetLatestData(Dictionary`2 latestData)
at Microsoft.TeamFoundation.WorkItemTracking.Internals.WorkItemHelper.LoadWorkItemFieldData(IRowSetCollectionHelper tables, IWorkItemOpenFieldDataHelper helper)
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.LoadWorkItemFromRowSetInternal(Int32 rev, Nullable`1 asof, IWorkItemRowSets witem)
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem..ctor(WorkItemStore store, Int32 id, Int32 revision)
at VstsSyncMigrator.Engine.WorkItemStoreContext.GetRevision(WorkItem workItem, Int32 revision) in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\ComponentContext\WorkItemStoreContext.cs:line 202
at VstsSyncMigrator.Engine.WorkItemMigrationContext.ReplayRevisions(List`1 revisionsToMigrate, WorkItem sourceWorkItem, WorkItem targetWorkItem, Project destProject, WorkItemStoreContext sourceStore, Int32 current, WorkItemStoreContext targetStore) in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 361
Is there any way to overcome this while maintaining the full revision history?
The issue is overcome if I migrate only the tip revisions.

Azure DevOps Server: Migrating Test Cases - Expecting end of string error

I am attempting my first migration between two different collections on Azure DevOps Server 2019.
The new collection has a custom inheritance process model.
I am trying to migrate test cases only for now. I would like to migrate test cases, test suites, and test plans.
I have added the configuration as per my understanding, but the migration keeps on failing.
Error message:
migration.exe Warning: 0 : [EXCEPTION] Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: Expecting end of string. The error is caused by «BY».
at Microsoft.TeamFoundation.WorkItemTracking.Client.Query.Initialize(WorkItemStore store, String wiql, IDictionary context, Int32[] ids, Int32[] revs, Boolean dayPrecision)
Redacted Processor from the config file below.
Thanks!
"Processors": [
{
"ObjectType": "VstsSyncMigrator.Engine.Configuration.Processing.NodeStructuresMigrationConfig",
"PrefixProjectToNodes": false,
"Enabled": false,
"BasePaths": [
"****\\Market Regulation\\Market Surveillance - Bonds",
"****\\Trading Value Stream"
]
},
{
"ObjectType": "VstsSyncMigrator.Engine.Configuration.Processing.WorkItemMigrationConfig",
"ReplayRevisions": true,
"PrefixProjectToNodes": false,
"UpdateCreatedDate": true,
"UpdateCreatedBy": true,
"UpdateSourceReflectedId": false,
"BuildFieldTable": false,
"AppendMigrationToolSignatureFooter": false,
"QueryBit": "AND [System.AreaPath] = '****\\Market Regulation\\Market Surveillance – Bonds' AND [System.WorkItemType] = 'Test Case' ",
"OrderBit": "ORDER BY [System.Id]",
"Enabled": true,
"LinkMigration": true,
"AttachmentMigration": true,
"AttachmentWorkingPath": "c:\\temp\\WorkItemAttachmentWorkingFolder\\",
"FixHtmlAttachmentLinks": false,
"SkipToFinalRevisedWorkItemType": false,
"WorkItemCreateRetryLimit": 5,
"FilterWorkItemsThatAlreadyExistInTarget": true,
"PauseAfterEachWorkItem": false,
"AttachmentMazSize": 480000000,
"CollapseRevisions": false
}
]
I believe your "OrderBit" syntax is wrong, it should look like this:
"OrderBit": "[System.ChangedDate] desc"
Just adapt it to your situation.

Programmatically set active session in Zed Attack Proxy

We're working with the zaproxy api and we're trying to set a session to "active" with the setActiveSession() API-call, which is documented here and takes two argument, the site and the session. The problem we're running into is that we keep getting the error:
{
"code": "illegal_parameter",
"message": "Provided parameter has illegal or unrecognized value",
"detail": "session"
}
Assuming we have the following sessions from the sessions() API-call,
{
"sessions": [
{
"session": [
"Session 1",
{
"JSESSIONID": {
"comment": "",
"domain": "localhost",
"domainAttributeSpecified": false,
"expired": false,
"expiryDate": null,
"name": "JSESSIONID",
"path": "/",
"pathAttributeSpecified": false,
"persistent": false,
"secure": false,
"value": "941A60311B3C63C69C5887F531E7090A",
"version": 0
}
},
"16"
]
}
]
}
What value do we need to send in the session field to make this API-call successful? We've tried value field in the "complex" JSESSIONID object, as well as the name "Session 1" and the "16" (under the assumption that it was an id of some sort), in the session array. All of them return the same error.
[Edit] I just saw that zap is logging the following into the terminal, when we make these calls:
1055328 [ZAP-ProxyThread-106] WARN org.zaproxy.zap.extension.api.API - ApiException while handling API request:
Provided parameter has illegal or unrecognized value (illegal_parameter) : session
at org.zaproxy.zap.extension.httpsessions.HttpSessionsAPI.handleApiAction(Unknown Source)
at org.zaproxy.zap.extension.api.API.handleApiRequest(Unknown Source)
at org.parosproxy.paros.core.proxy.ProxyThread.processHttp(Unknown Source)
at org.parosproxy.paros.core.proxy.ProxyThread.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
After a bit more trial and error in the API-Browser, we've discovered that the correct value is indeed "Session 1", but we were sending the name in quotations marks, i.e. "Session 1", but the correct way to send it is without them, i.e. Session 1.