• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to run rest API in VBA taking parameter from 1 sheet and store response values in another sheet in columns?

Nihar Arisal

New Member
Hi Team,

I have a situation where i need to run one API based on different parameters and need to store the response values in another sheet. parameter will be from one sheet.

refer the attached excel file for the data where in RepoData sheet we have repositories and Result sheet we need values to be stored like this from API.

Curl for API
curl --location 'https://sonarcloud.io/api/measures/...y_rating,security_review_rating&branch=master' \
--header 'Authorization: Basic NGZhNmFkZDFhNmMyNDRkMjdlNjI0MDVjYTQ3YWJmNjhmNzdiYjI0Njo='

Eg: Response

{
"component": {
"id": "AX1rRbipdJtPV1ET12n1",
"key": "imonline_accountmanagement.webapi.reseller",
"name": "AccountManagement.WebApi.Reseller",
"qualifier": "TRK",
"measures": [
{
"metric": "coverage",
"value": "43.8",
"bestValue": false
},
{
"metric": "reliability_rating",
"value": "1.0",
"bestValue": true
},
{
"metric": "code_smells",
"value": "126",
"bestValue": false
},
{
"metric": "duplicated_lines_density",
"value": "4.6",
"bestValue": false
},
{
"metric": "security_rating",
"value": "1.0",
"bestValue": true
},
{
"metric": "security_hotspots_reviewed",
"value": "0.0",
"bestValue": false
},
{
"metric": "security_hotspots",
"value": "141",
"bestValue": false
},
{
"metric": "security_review_rating",
"value": "5.0",
"bestValue": false
},
{
"metric": "sqale_rating",
"value": "1.0",
"bestValue": true
},
{
"metric": "bugs",
"value": "0",
"bestValue": true
},
{
"metric": "tests",
"value": "41"
},
{
"metric": "uncovered_lines",
"value": "444",
"bestValue": false
},
{
"metric": "duplicated_blocks",
"value": "13",
"bestValue": false
},
{
"metric": "ncloc",
"value": "4361"
},
{
"metric": "vulnerabilities",
"value": "0",
"bestValue": true
}
]
}
}


Thanks
 

Attachments

  • RepositoryData.xlsx
    10.1 KB · Views: 4

Nihar Arisal

As You have read from :
  • Cross-Posting. Generally, it is considered poor practice to cross post. That is to post the same question on several forums in the hope of getting a response quicker.
  • If you do cross-post, please put that in your post.
  • Also if you have cross-posted and get an Solution elsewhere, have the courtesy of posting the Solution here so other readers can learn from the answer also, as well as stopping people wasting their time on your answered question.
Every Forum has same kind of rules with Cross-Posting.
 
Could we have explicit instructions on what to do manually (or VBA for that matter?) to get the likes of your response data from the web?

[So far all I've managed to do is rearrange your quoted response by parsing it as JSON to this:
1708086229611.png
but it looks like you've already got there anyway.]
 
Back
Top