API Development - Error codes

Sample Code PHP (GET Request)

Note: Get request is deprecated, Please use Post request.
Forex Latest Prices: Find below a simple PHP example for getting exchange rate data via the FCS API's latest endpoint.

$access_key = "API_KEY"; // Your API access key, Signup to get API KEY 
$symbol = "EUR/USD"; // FX Pairs

// Enter your API URL below
$api_url = "https://fcsapi.com/api-v3/forex/latest?symbol=".$symbol."&access_key=".$access_key;

// Initialize CURL:
$ch = curl_init($api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch); // Store the data
curl_close($ch);

$response = json_decode($json, true); // convert JSON into Array
foreach ($response['response'] as $key => $value) {
  echo "<br>Open Price Of ".$value['symbol']." is ".$value['price']; // Open Price Of EUR/USD is 1.1266
}

Sample Code PHP (POST Request)

$access_key = "API_KEY"; // Your API access key, Signup to get API KEY 
$symbol = "EUR/USD"; // FX Pairs

// Enter your API URL below
$api_url = "https://fcsapi.com/api-v3/forex/latest";
$post = "symbol=".$symbol."&access_key=".$access_key;

// Initialize CURL:
$ch = curl_init($api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$json = curl_exec($ch); // Store the data
curl_close($ch);

$response = json_decode($json, true); // convert JSON into Array
foreach ($response['response'] as $key => $value) {
  echo "<br>Open Price Of ".$value['symbol']." is ".$value['price']; // Open Price Of EUR/USD is 1.1266
}

Sample Code jQuery.ajax

Real-time rates: Find below a simple jQuery.ajax example of getting exchange rate data via the FCS API's latest endpoint.

<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> 
<script>
access_key = "API_KEY"; // Your API access key, Signup to get API KEY
id = '1,2,3,4'; // Forex ids

$.ajax({
    url:
"https://fcsapi.com/api-v3/forex/latest?id=" + id + "&access_key=" + access_key,
    type:
"GET", // GET or POST
    dataType:
"json",
    success: function(data) {
        console.log("Price of "+data.response[0].symbol + " is "+data.response[0].price); // Price of EUR/USD is 1.1064;
    }
});

</script>

Errors

There are multiple errors that help you to understand issue with your API response.

Code Details
200 Your API is working. Response successfully
101 API Key error : Your access key is wrong, Please login in your dashboard and get your API KEY.
102 Your Account is not activated.
103 Your Account is blocked.
104 API Key error : You have not set your access_key in parameters.
111 Full access is not allow with DEMO API key, so please signup and get your api key to unlock full access on FCS.
112 Data not found, it may be you set wrong values and it may be no data from our side. More error details will be send in API response.
113 Required parameters are missing, Please check api documentaion also check message in API response for more error details.
211 You have used your all monthly API request limit.
212 Your Account is expired, You need to pay your montly fee or downgrade to free version.
213 Error 213 is only for Free user, free user are not allow more than 1 request per minute..