-
-
Save scottwater/1323116 to your computer and use it in GitHub Desktop.
Quick KickoffLabs API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -d '[email protected]&api_key=your_api_key' https://api.kickofflabs.com/v1/1905/subscribe | |
curl -G -d "[email protected]" https://api.kickofflabs.com/v1/1905/info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, "[email protected]"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, '[email protected]', social_id='1QNF') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 => '[email protected]') | |
KickoffLabsAPI.info(1905, :email => '[email protected]') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' 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, "[email protected]") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment