In computer programming, an application programming interface (API) is a set of routines, protocols, and tools for building software and applications.
An API expresses a software component in terms of its operations, inputs, outputs, and underlying types, defining functionalities that are independent of their respective implementations, which allows definitions and implementations to vary without compromising the interface. A good API makes it easier to develop a program by providing all the building blocks, which are then put together by the programmer.
An API may be for a web-based system, operating system, or database system, and it provides facilities to develop applications for that system using a given programming language. As an example, a programmer who develops apps for Android may use an Android API to interact with hardware, like the front camera of an Android-based device.
In this session of “what I’ve automated with AutoHotkey” I explain how I saved my client a ton of time and money by using the Google Translate API.
How I used Google Translate to save the client both time and money
Below is the code I used in the code to Google Translate to save the client both time and money. Make sure you put my Excel function library and Maestrith’s Notify function in your library.
In the below AutoHotkey Podcast we discussed how to send API calls from an active IE window. A subscriber asked me to share the code so below is the example code I mentioned in the recording
Make sure you get our Web Scraping syntax writer
Connecting to active IE window and sending an API call
Being able to easily monitor your network traffic is very helpful when working with APIs as well as Web Scraping.
In these two videos I demonstrate how to use Fiddler to monitor network traffic. Fiddler is a great, free, tool that can help you see what traffic is going on behind the scenes from browsers, programs, apps, and AutoHotkey. FYI- If you don’t care to use Fiddler / an external tool, a lot of this can be done with the developer tools inside a browser however they are somewhat limited in functionality. I’ve tried other network monitoring tools but they are ridiculously complex.
Use Fiddler to monitor network traffic
Intro to using Fiddler to peek at traffic
Use AutoHotkey to easily clear network traffic in Fiddler
;*********************Clear traffic in Fiddler Need to uncomment**********************************
;~ #IfWinActive ahk_exe Fiddler.exe ;Uncomment this if you want to only do it when Fiddler is Active
^+c:: ;Hotkey to clear traffic
ControlFocus,WindowsForms10.SysListView32.app.0.2bf8098_r6_ad12 ;Control where Traffic is (must be active)
Send ^x ;Clear Traffic
return
;~ #IfWinActive ;Uncomment this if you uncommend the above #IfWinactive
Using Filters in Fiddler to clean-up what Fiddler is tracking
#SingleInstance,Force
Random:=[],Dup:=[],Items:=[]
for a,b in StrSplit("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") ;put whatever characters you want in here
Random.Push(b) ;Add each character to Random Array
InputBox,Count,How Many Codes,How Many Codes do you want?
InputBox,Length,How Long For Each Code,How Long?
While(Items.MaxIndex()<Count){ ;Keep iterating until you have enough "keys"
Out:="" ;Clear out variable
while(StrLen(Out)<Length){
Random,Digit,0,% Random.MaxIndex() ;keep max lenght of random at right level
Out.=Random[Digit] ;append the Random digit to out.
}
if(!Dup[Out])
Items.Push(Out),Dup[Out]:=1 ;Add key to object
}
for a,b in Items ;Iterate over list
Total.=b "`n" ;Add to total with new line
msgbox % Clipboard:=Total