Skip to content

Instantly share code, notes, and snippets.

@scottwater
Last active February 15, 2021 04:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scottwater/1323116 to your computer and use it in GitHub Desktop.
Save scottwater/1323116 to your computer and use it in GitHub Desktop.
Quick KickoffLabs API
curl -d 'email=scott@kickofflabs.com&api_key=your_api_key' https://api.kickofflabs.com/v1/1905/subscribe
curl -G -d "email=scott@kickofflabs.com" https://api.kickofflabs.com/v1/1905/info
using System.Net;
public static string Subscribe(int landingPageId, string email, string api_key, string socialId = null, bool skipAR = false) {
var url = string.Format("https://api.kickofflabs.com/v1/{0}/subscribe", landingPageId);
var data = "email=" + email + "&api_key=" + api_key + (socialId != null ? "&social_id=" + socialId : "") + (skipAR ? "& skip_ar=1" : "");
using(var client = new WebClient()) {
try {
return client.UploadString(url, data);
}
catch(WebException){
return "Could not subscribe the email address " + email;
}
}
}
Subscribe(1905, "scott@kickofflabs.com");
import requests
def subscribe(landing_page_id, email, api_key, **args):
args['email'] = email
args['api_key'] = api_key
r = requests.post('https://api.kickofflabs.com/v1/%s/subscribe' % landing_page_id, args)
if r.status_code == 200:
print r.content
else:
print 'could not subscribe the email %s' % email
subscribe(1905, 'scott@kickofflabs.com', social_id='1QNF')
require 'httparty'
require 'crack'
class KickoffLabsAPI
include HTTParty
base_uri 'https://api.kickofflabs.com'
def self.subscribe(page_id, args={})
args[:api_key] = ENV['KICKOFFLABS_API_KEY'] if ENV['KICKOFFLABS_API_KEY']
response = post("/v1/#{page_id}/subscribe", :body => args)
if response.code == 200
Crack::JSON.parse(response.body)
else
"Failed with status #{response.code} and body #{response.body}"
end
end
def self.info(page_id, args={})
args[:api_key] = ENV['KICKOFFLABS_API_KEY'] if ENV['KICKOFFLABS_API_KEY']
response = get("/v1/#{page_id}/info", :query => args)
if response.code == 200
Crack::JSON.parse(response.body)
else
"Failed with status #{response.code} and body #{response.body}"
end
end
end
KickoffLabsAPI.subscribe(1905, :email => 'scott@kickofflabs.com')
KickoffLabsAPI.info(1905, :email => 'scott@kickofflabs.com')
' submitted by @xandersherry
Imports System.Net
Public Shared Function Subscribe(landingPageId As Integer, email As String, api_key as String, Optional socialId As String = Nothing, Optional skipAR As Boolean = False) As String
Dim url = String.Format("https://api.kickofflabs.com/v1/{0}/subscribe", landingPageId)
Dim data = "email=" + email + "&api_key=" + api_key + (If(socialId IsNot Nothing, "&social_id=" + socialId, "")) + (If(skipAR, "& skip_ar=1", ""))
Using client = New WebClient()
Try
Return client.UploadString(url, data)
Catch generatedExceptionName As WebException
Return "Could not subscribe the email address " + email
End Try
End Using
End Function
Subscribe(1905, "scott@kickofflabs.com")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment