API Automation

Local API for Routine Automation Operations

1. Refresh the page


http://127.0.0.1:35000/api/v1/profile/refresh?profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx



2. The current tab to open the specified URL


http://127.0.0.1:35000/api/v1/profile/openurl?profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&url=www.xlogin.us



3. Get the source code of the web page


http://127.0.0.1:35000/api/v1/profile/source?profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx




4. The args parameter is the passing parameter of the function, such as findElementByID(args).
When the “click” is true, after finding the specified element, perform the click operation. When it is false, it will not perform a click operation.

Index means that when there are multiple elements, it will specifically click which element. Starting from the number 0, -1 is one of the random elements. This parameter is used when “click” is true.


Take the attribute value of the specified element:


http://127.0.0.1:35000/api/v1/profile/getAttribute?profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&args=[{"ELEMENT": "95365abe-6746-4703-8cfd-6316580f5289", "element-6066-11e4-a52e-4f735466cecf": "95365abe-6746-4703-8cfd-6316580f5289"}, "style"]


Generally, the args parameter is a JSON string that is combined with Element_ID which is obtained after findElement performs the find element operation.

For example:

 [{"ELEMENT": "95365abe-6746-4703-8cfd-6316580f5289", "element-6066-11e4-a52e-4f735466cecf": "95365abe-6746-4703-8cfd-6316580f5289"}, "value"]


The above example is take the value of the 95365abe-6746-4703-8cfd-6316580f5289 element.



5. Perform element click operation through the selector


http://127.0.0.1:35000/api/v1/profile/findElement?profileId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&function=findElementByID&args=kw&click=true&index=-1



6. Send a text to the web page


First, you can use findElementByID to find the elementId of the element, for example:


http://127.0.0.1:35000/api/v1/profile/findElement?profileId=xxxxxxxx -xxxx-xxxx-xxxx-xxxxxxxxxxxx&function=findElementByID&args=kw&click=false&index=-1


You can also use: findElementByXPath to find the elementId of an element, for example:


http://127.0.0.1:35000/api/v1/profile/findElement?profileId=xxxxxxxx -xxxx-xxxx-xxxx-xxxxxxxxxxxx&function=findElementByXPath&args=Ly8qW0BpZD0ia3ciXQ==&click=false&index=-1


The args parameter above is transmitted using base64 encoding, and is decoded as: //* [@ id="kw"]


The GET request above will return:

{"status":"OK","value":"{\"element-6066-11e4-a52e-4f735466cecf\":\"49e49e71-2a55-4e79-a41b-86840ffd18c8\"}"}


49e49e71-2a55-4e79-a41b-86840ffd18c8 is the elementId to be used.


http://127.0.0.1:35000/api/v1/profile/sendKeys?profileId=xxxxxxxx -xxxx-xxxx-xxxx-xxxxxxxxxxxx&elementId=49e49e71-2a55-4e79-a41b-86840ffd18c8&value=5Lit5paHYWJjMTIz


The above value is also transmitted using base64 encoding to prevent the GET transmission failure. Value=5Lit5paHYWJjMTIz, that is, to send Chinese abc123 string in this web control. Note that these automatic operations can only be performed after the web page is loaded, otherwise, the actions may be blocked.


The 35000 port here is the port set in "My account" in the XLogin client software. Please pay attention to opening and changing it.



7. Client restart interface


http://127.0.0.1:35000/api/v1/client/restart




8. Import address API:


http://127.0.0.1:35000/api/v1/profile/addresses/import


② POST  


③ profileId


④ body (JSON need base64 encode):  


[{"name_on_card":"xlogin","nickname":"xlogin","card_number":"1241526456789","expiration_month":9,"expiration_year":2024}]



9. Import payment method API:


http://127.0.0.1:35000/api/v1/profile/credit_cards/import


② POST


③ profileId


④ body (JSON need base64 encode): 


[{"organization":"xlogin ltd","street_address":"xlogin  100","district":"Qixia","city":"nanjing","province":"Jiangsu","zipcode":"210046","country_code":"CN","number":"15644444","full_name":"dama","email":"[email protected]"}]