It seems that the error you are encountering is due to the use of an incorrect type in your request. According to the API documentation for new code periods, the type parameter must be one of the following allowed types:
SPECIFIC_ANALYSIS - can be set at the branch level only
PREVIOUS_VERSION - can be set at any level (global, project, branch)
NUMBER_OF_DAYS - can be set at any level (global, project, branch)
REFERENCE_BRANCH - can only be set for projects and branches
In your command, you are using type=specific, which is not valid. If you want to set a specific new code period, you should use type=SPECIFIC_ANALYSIS (with the correct casing) and ensure that you are making the request at the branch level since this type cannot be set at the global or project level.
Thank you good sir
indeed i had wrong value and after I used comand template that you specified I had progress.
Hoever I run into new error which also somewhat puzzles me. Maybe you have insight about it also?
{“errors”:[{“msg”:“New code definition type \u0027SPECIFIC_ANALYSIS\u0027 requires a value”}]
I provided analysis key in command… Not sure what more values it wants…
Hi @Peteris ,
It looks like you’re on the right track with correcting the type parameter to SPECIFIC_ANALYSIS , but the error message you’re encountering now indicates that the API expects more specific details regarding the analysis key you’re providing.
Make sure to replace <valid_analysis_key> with the actual key from a successful analysis. If you continue to have trouble, you may want to retrieve the list of analyses for the given project via the /api/project_analyses/search endpoint to confirm you’re using the right key.
I did exactly that - I got list of existing analyses from that endpoint
…/api/project_analyses/search?project=myproject
For example got such analysis amongst whole list:
…
3
key
1f6d824b-c1d6-4697-94ac-a9eb78736654
date
2025-01-01T23:30:23+0000
events
…
But when I am using this 1f6d824b-c1d6-4697-94ac-a9eb78736654 for analysis parameter I still get
{“errors”:[{“msg”:“New code definition type \u0027SPECIFIC_ANALYSIS\u0027 requires a value”}]