Link to Project FIles : REST API call with No Auth : github.com/jc566/RUclips_Solutions/blob/master/Powershell%20Scripts/REST%20API%20intro/GET/RestAPI%20Calls%20-%20No%20Auth%20Token.ps1 REST API call with Auth & Personal Access Token : github.com/jc566/RUclips_Solutions/blob/master/Powershell%20Scripts/REST%20API%20intro/GET/RestAPI%20Calls%20-%20With%20Auth%20Token.ps1 Important Time Stamps 0:33 - Quick explanation of URL endpoints 1:17 - Setting up URL 2:36 - Creating query string 3:19 - Result of API call with GET method 3:43 - Some examples of how to digest the data retrieved 5:19 - Creating Azure Devops Authorization token 6:44 - Updating query string for API call with Personal Access Token 9:19 - Create the token pairing 10:42 - Creating the header variable 11:15 - Quick breakdown of what to expect from running API call with PAT 12:02 - Showing the usefulness of "-depth" parameter Link to HTTP Request Methods : developer.mozilla.org/en-US/docs/Web/HTTP/Methods Cat Facts API : alexwohlbruck.github.io/cat-facts/docs/ Azure Devops API Documentation : docs.microsoft.com/en-us/rest/api/azure/devops/distributedtask/variablegroups/get%20variable%20groups?view=azure-devops-rest-5.1
Great video!! I used this video to understand concepts of REST API with PowerShell and then asked ChatGPT the proper PowerShell-related questions to help guide me perform ETL on a cloud-based database.
The code shown at 3:28 didn't work for me. It said "The variable 'response' is assigned but never used." I had to add Write-Output $response. How is this possible? Thank you for the video, btw...
Im not sure what difference you might have but for that time stamp if you select the entirety of line 5 and press F8, it should populate the variables $response with the value of the 'Invoke-RestMethod'. If you are using 'write-host $response' or 'write-output $response' and the value of $response is empty, that means it hasnt properly ran the code since its just an empty variable. It should contain the result of the 'Invoke-RestMethod'
Hmm, I will try this...I'm more focused on security aspect using powershell(windows 10 pro) and the linux instance/image you can download through the windows playstore. I use tools like Putty. Random rant, but I'm just sharing all this in case you also one want to go over how windows pro users can also do some linux stuff and/or use cases of Putty , and/or powershell means to try encryption,hashing, etc. No expectations, no obligations, but just a thought.
Hey thanks for the kind words. Im working on the next video to cover post + other http methods. Just busy with my day job. Ill follow up in this comment when the other videos up!
@@CodeDoge Thanks a lot for your time. As I am new to powershell ,I am in need of some help related to this with respect to my project. Is there any possibility to get your support?
@@divyalathamadapuri1754 Want to split that paycheck ;) jokes aside, I dont provide personal help for obvious reasons, but I cant try and see what I can do with a follow up post video
Can you pls add a session to show - once Data fetched from REST API in Json format thru PS, how to save the the filtered data in excel or csv ! Im using Postman to access Endpoints and then get the ready to use PS cmdlt from Postman snippets inside PS ISE. But need to understand the logic to fetch the required amount of Data from huge JSON body and then save filtered data in excel or csv for reporting purpose
Maybe I can make your request a future video, but for now, just save the object received from an API call as a object and convert to json. Then open a file and write into the file. There is a powershell module called PSExcel that should help you with Excel specifically.
@@aronichakraborty5192 Depending on the API call being made, the user in which the PAT is authenticating as might require additional access within SonarQube portal. Difficult to help you out without screen share lol. But ultimately these are the steps required to make a api call. An issue about forbidden access with a valid PAT is likely because you PAT doesnt have access rights to perform an action. Similar to how I overviewed that Azure Devops PAT creation gives so many options to access rights, SonarQube is likely the same concept.
Link to Project FIles :
REST API call with No Auth :
github.com/jc566/RUclips_Solutions/blob/master/Powershell%20Scripts/REST%20API%20intro/GET/RestAPI%20Calls%20-%20No%20Auth%20Token.ps1
REST API call with Auth & Personal Access Token :
github.com/jc566/RUclips_Solutions/blob/master/Powershell%20Scripts/REST%20API%20intro/GET/RestAPI%20Calls%20-%20With%20Auth%20Token.ps1
Important Time Stamps
0:33 - Quick explanation of URL endpoints
1:17 - Setting up URL
2:36 - Creating query string
3:19 - Result of API call with GET method
3:43 - Some examples of how to digest the data retrieved
5:19 - Creating Azure Devops Authorization token
6:44 - Updating query string for API call with Personal Access Token
9:19 - Create the token pairing
10:42 - Creating the header variable
11:15 - Quick breakdown of what to expect from running API call with PAT
12:02 - Showing the usefulness of "-depth" parameter
Link to HTTP Request Methods :
developer.mozilla.org/en-US/docs/Web/HTTP/Methods
Cat Facts API :
alexwohlbruck.github.io/cat-facts/docs/
Azure Devops API Documentation :
docs.microsoft.com/en-us/rest/api/azure/devops/distributedtask/variablegroups/get%20variable%20groups?view=azure-devops-rest-5.1
Great video!!
I used this video to understand concepts of REST API with PowerShell and then asked ChatGPT the proper PowerShell-related questions to help guide me perform ETL on a cloud-based database.
awesome glad it helped. I assume chatgpt will make me obsolete in no time...fml hopefully Im still around when AI takes over
The code shown at 3:28 didn't work for me. It said "The variable 'response' is assigned but never used." I had to add Write-Output $response. How is this possible? Thank you for the video, btw...
Im not sure what difference you might have but for that time stamp if you select the entirety of line 5 and press F8, it should populate the variables $response with the value of the 'Invoke-RestMethod'.
If you are using 'write-host $response' or 'write-output $response' and the value of $response is empty, that means it hasnt properly ran the code since its just an empty variable. It should contain the result of the 'Invoke-RestMethod'
Hmm, I will try this...I'm more focused on security aspect using powershell(windows 10 pro) and the linux instance/image you can download through the windows playstore. I use tools like Putty. Random rant, but I'm just sharing all this in case you also one want to go over how windows pro users can also do some linux stuff and/or use cases of Putty , and/or powershell means to try encryption,hashing, etc. No expectations, no obligations, but just a thought.
I definitely want to do more for windows/linux, but my will power is constantly stomped out by laziness. One day hopefully
@@CodeDoge universal struggle
@@Jaemon4Eva this be the real true true
@@CodeDoge lol
Thanks a lot! Its a really great intro!
I'm glad you like it! hope it was helpful
Love powershell. Thank you needed this tutorial
just glad it was helpful!
THANK YOU!
yup
Such a great explanation. Thank you! Are there any videos for POST method and all?
Hey thanks for the kind words. Im working on the next video to cover post + other http methods. Just busy with my day job. Ill follow up in this comment when the other videos up!
@@CodeDoge Thanks a lot for your time. As I am new to powershell ,I am in need of some help related to this with respect to my project. Is there any possibility to get your support?
@@divyalathamadapuri1754 Want to split that paycheck ;) jokes aside, I dont provide personal help for obvious reasons, but I cant try and see what I can do with a follow up post video
Thank you, great video!
just glad it helped!
Can you pls add a session to show - once Data fetched from REST API in Json format thru PS, how to save the the filtered data in excel or csv ! Im using Postman to access Endpoints and then get the ready to use PS cmdlt from Postman snippets inside PS ISE. But need to understand the logic to fetch the required amount of Data from huge JSON body and then save filtered data in excel or csv for reporting purpose
Maybe I can make your request a future video, but for now, just save the object received from an API call as a object and convert to json. Then open a file and write into the file. There is a powershell module called PSExcel that should help you with Excel specifically.
I am getting error - the remote server returned an error :401 unauthorised
Make sure you are using a valid Personal Access Token
@@CodeDoge yes token is correct . I have tried everything still facing this. We are trying to call SonarQube API from Powershell
@@aronichakraborty5192 Depending on the API call being made, the user in which the PAT is authenticating as might require additional access within SonarQube portal. Difficult to help you out without screen share lol. But ultimately these are the steps required to make a api call. An issue about forbidden access with a valid PAT is likely because you PAT doesnt have access rights to perform an action. Similar to how I overviewed that Azure Devops PAT creation gives so many options to access rights, SonarQube is likely the same concept.
🙏
Bless & thanks
glad it helped!!
👍
☝️