Developer Guide

Subscribe Plan

Subscribe user to a plan.

NOTE: You need to register for a Reseller API key before using this REST API. Please visit Reseller Program page for the information of reseller account application.

GET http://api.fraudlabspro.com/v1/plan/subscribe

Request
Parameter Description
key (required) Your reseller API key.
format (optional) Return the result in json or xml format. Default: xml
Valid values: json | xml
username (required) Username of the account.
plan (required) Plan code for the plan.
Valid values: MICRO | SMALL | MEDIUM | LARGE | ENTERPRISE

Note: Only MICRO plan is accepted at this moment.
Response
Parameter Description
fraudlabspro_error Error code in this transaction. Please refer to Error Codes for complete list.
fraudlabspro_message More information about the status of this transaction. Please refer to Error Codes for complete list.
api_key API key for the plan subscribed.
plan_name Plan name for the plan subscribed.
query_limit Total query available for the plan subscribed.
rule_limit Maximum rules can be added to the plan.
Sample Code
<?php
$apiKey = 'Your_Reseller_API_Key';
$params['format']           = 'json';
$params['username']         = 'demoaccount';
$params['plan']             = 'MICRO';

$query = '';

foreach($params as $key=>$value){
	$query .= '&' . $key . '=' . rawurlencode($value);
}

$try = 0;
do {
	////////////
	//For https request, please make sure you have enabled php_openssl.dll extension.
	//
	//How to enable https
	//- Uncomment ;extension=php_openssl.dll by removing the semicolon in your php.ini, and restart the apache.
	//
	//In case you have difficulty to modify the php.ini, you can always make the http request instead of https.
	////////////
	$result = file_get_contents('https://api.fraudlabspro.com/v1/plan/subscribe?key=' . $apiKey . $query);
} while(!$result && $try++ < 3);

$data = json_decode($result);

print_r($data);
?>
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

public class FLP {
	public static void main(String[] args) {
		try {

		URL url = new URL("https://api.fraudlabspro.com/v1/plan/subscribe?key=Your_Reseller_API_Key&format=json&username=demoaccount&plan=MICRO");
		HttpURLConnection conn = (HttpURLConnection) url.openConnection();
		conn.setRequestMethod("GET");
		conn.setRequestProperty("Accept", "application/json");

		if (conn.getResponseCode() != 200) {
			throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
		}

		BufferedReader br = new BufferedReader(new InputStreamReader(
			(conn.getInputStream())));

		String output;

		while ((output = br.readLine()) != null) {
			System.out.println(output);
		}

		conn.disconnect();

	  } catch (MalformedURLException e) {

		e.printStackTrace();

	  } catch (IOException e) {
		e.printStackTrace();
	  }
	}
}
Imports System.Net
Partial Public Class _Default
	Inherits System.Web.UI.Page

	Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		Dim request As HttpWebRequest = Nothing
		Dim response As Net.HttpWebResponse = Nothing
		Dim stream As IO.Stream = Nothing

		Dim apiKey As String = "Your_Reseller_API_Key"
		Dim format As String = "json"
		Dim username As String = "demoaccount"
		Dim plan As String = "MICRO"

		request = Net.WebRequest.Create("https://api.fraudlabspro.com/v1/plan/subscribe?key=" & apiKey & _
		"&format=" & System.Web.HttpUtility.UrlEncode(format) & _
		"&username=" & System.Web.HttpUtility.UrlEncode(username) & _
		"&plan=" & System.Web.HttpUtility.UrlEncode(plan)

		request.Method = "GET"
		response = request.GetResponse()

		Dim reader As System.IO.StreamReader = New IO.StreamReader(response.GetResponseStream())

		Page.Response.Write(reader.ReadToEnd)
	End Sub
End Class
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Net;

public partial class _Default : System.Web.UI.Page
{

	protected void Page_Load(object sender, System.EventArgs e)
	{
		HttpWebRequest request = null;
		System.Net.HttpWebResponse response = null;
		System.IO.Stream stream = null;

		string apiKey = "";
		string format = "json";
		string username = "demoaccount";
		string plan = "MICRO";

		request = System.Net.WebRequest.Create("https://api.fraudlabspro.com/v1/plan/subscribe?key=" + apiKey + "&format=" + System.Web.HttpUtility.UrlEncode(format) + "&username=" + System.Web.HttpUtility.UrlEncode(username) + "&plan=" + System.Web.HttpUtility.UrlEncode(plan));

		request.Method = "GET";
		response = request.GetResponse();

		System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());

		Page.Response.Write(reader.ReadToEnd());
	}
}
import httplib
import urllib

p = { 'key': 'Your_Reseller_API_Key', 'format': 'json', 'username': 'demoaccount', 'plan': 'MICRO' }

conn = httplib.HTTPConnection("api.fraudlabspro.com")
conn.request("GET", "/v1/plan/subscribe?" + urllib.urlencode(p))
res = conn.getresponse()
print res.read()