how to get azure devops api data usign javascript extract in table format

119 views Asked by At
$(document).ready(function() {
$.ajax({
url: 'https://dev.azure.com/{org}/infosoftaz/_apis/wit/workitems/1?api-version=7.0',

            type:"GET",
            dataType: 'json',
            headers: {
                'Authorization': 'Basic' + btoa("" + ":" + '{PAT}')
            },
            
        }).done(function( results ) {
            console.log( results );
            result = JSON.stringify(results);
            
            var div = "";
            div += "<p>" + result + "</p>";
           div += "<p class='description'>" + result + "</p>";
           
            $('#data_fetch').html(div);
        });

});

<div id="data_fetch"></div>
Column A Column B
Cell 1 Cell 2
Cell 3 Cell 4
1

There are 1 answers

0
Ging Yuan-MSFT On

According to your description, you can refer to this answer and then extract the result in html table.

Use:

 JSON.parse(results)

Please check if it meets your requirements.