Help with simple API code.

koulde

Junior Member
Joined
Aug 3, 2013
Messages
148
Reaction score
371
Hello,
I must say from the begging that I am not familiar with any of the programming languages, I barely know some PHP and thats just to fix wordpress bugs.

I've got this API for SMS portal. I am suppose to send bulk sms to clients each with a specific text, and since I lack the experience I've been using excel and google docs with both mobile numbers and messages in certain cells to open the urls and execute the "send message" command ( I think its called "call" or something) and the sms portal server is suppose to return a code if the SMS was sent or not. Well, it hits and miss since importdata function isn't that much.

This is API when used as a url:
https://www.[the website].com/api/?username=[the username]&password=[the api password]&sms=[the message]&mobile=[the mobile phone]&binary=[sms language]

If its successful in sending the message it will return a code on screen as such:
OK_1_1

Viewing the screen as "view-source" shows the following:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
OK_1_1

I am totally lost, wish I knew some vb to get this done.
I am hoping if anyone can guide me to execute 200 urls and return the code I get as result.
 
Your question is missing the most important piece of information., which is your current working code.

What you need right now is to put your code that calls the API into a loop. For ex,

Code:
Dim i As Integer
i = 1

Do While i < 200
    // insert your api call request 
    // fetch the result and save the response into a column
    i = i + 1
Loop
 
I did not build any code, nothing. I don't know how. All I am doing now is this and repeat for the whole list:
=importdata(CONCATENATE("https://www.website.com/api/?username=",Settings!B$1,"&password=",Settings!B$2,"&sms=",C2,"&mobile=",B2,"&binary=0"))

Sorry if my thread isn't clear enough.
 
#!/usr/bin/python3
import requests

username = 'username'
pasword = 'password'
message = 'message'

url = 'https://www.THEWEBSITE.com/api/?username={username)&password={password}&sms={message}&mobile={phone}&binary={lang}'.format(
username=username, password=password, message=message)

r = requests.get(url, timeout=30)

json = r.json()



It isn't much, but it's a nudge in the right direction.
 
Back
Top