Skip to content

Instantly share code, notes, and snippets.

@aycabas
Last active March 30, 2023 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aycabas/188a5b82cb0bd43976a0320b1fcced2b to your computer and use it in GitHub Desktop.
Save aycabas/188a5b82cb0bd43976a0320b1fcced2b to your computer and use it in GitHub Desktop.
an HTTP call to DevOps API
import { DevOpsModel } from "../models/devOpsModel";
export async function DevOpsWorkItems(): Promise<DevOpsModel[]>
{
try
{
let devopsItems: DevOpsModel[] = [];
const req = await fetch( "https://dev.azure.com/ORGANIZATION_NAME/PROJECT_NAME/_apis/wit/workitems?ids=1,2,3,4,5&api-version=7.0",
{ method: "GET", headers: { "Content-Type": "application/json; charset=utf-8;", Authorization: "Basic " + btoa("Basic" + ":" + "DEVOPS_PERSONAL_ACCESS_TOKEN"), }, })
.then((response) => response.json()).then((req) => { return req; });
return;
}
catch (e)
{
throw e;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment