Skip to content

Commit

Permalink
fix: use api version that supports targets endpoint and fix display n…
Browse files Browse the repository at this point in the history
…ame parameter
  • Loading branch information
Roshick committed Mar 5, 2024
1 parent 1809d0b commit da634f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ snyk:
# Host of the Web UI to render links. Defaults to "app.snyk.io"
# If you use EU or AU Snyk account, change this to app.eu.snyk.io or app.au.snyk.io
appHost: app.snyk.io
# Uncomment to specify version of the API to use on the calls. Defaults to "2023-06-19~experimental".
# Uncomment to specify version of the API to use on the calls. Defaults to "2024-02-28".
# Override with care, not all versions have a target API
# apiVersion: 2023-06-19~experimental
# apiVersion: 2024-02-28
# uncomment to specify version for issues API specifically. Defaults to 2024-01-23
# issuesApiVersion: 2024-01-23
# Mocks the API calls, useful for development and for testing the plugin without a Snyk account. Defaults to "false"
Expand Down
5 changes: 2 additions & 3 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ export class SnykApiClient implements SnykApi {

getSnykApiVersion(): string {
return (
this.configApi.getOptionalString("snyk.apiVersion") ??
"2023-06-19~experimental"
this.configApi.getOptionalString("snyk.apiVersion") ?? "2024-02-28"
);
}
getSnykIssuesApiVersion(): string {
Expand Down Expand Up @@ -438,7 +437,7 @@ export class SnykApiClient implements SnykApi {
targetId = targetIdentifier;
} else {
const version = this.getSnykApiVersion();
const targetsAPIUrl = `${backendBaseUrl}/rest/orgs/${orgId}/targets?displayName=${encodeURIComponent(
const targetsAPIUrl = `${backendBaseUrl}/rest/orgs/${orgId}/targets?display_name=${encodeURIComponent(
targetIdentifier
)}&version=${version}`;
const targetResponse = await fetch(`${targetsAPIUrl}`, {
Expand Down

0 comments on commit da634f0

Please sign in to comment.