The pfSense Store

Author Topic: Server returned HTTP response code: 500 for REST API call  (Read 110 times)

0 Members and 1 Guest are viewing this topic.

Offline Vaibhav1

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Server returned HTTP response code: 500 for REST API call
« on: December 19, 2017, 02:12:14 pm »
Trying to block the IP using FauxAPI.

I'm trying to access the function_call API by making the HTTP request using JAVA code as follows,

Code: [Select]
phpFn = 'easyrule_block_alias_getid' and fnParams='wan'
Code: [Select]

HttpURLConnection con = (HttpURLConnection)url.openConnection();
con.setRequestProperty("fauxapi-auth", getAuth());
con.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
con.setRequestProperty("Accept-Encoding", "gzip, deflate, br");
con.setRequestProperty("Accept-Language", "en-US,en;q=0.9,hi;q=0.8");
con.setRequestProperty("Cache-Control", "max-age=0");
con.setRequestProperty("Connection", "keep-alive");
con.setRequestProperty("Upgrade-Insecure-Requests", "11");
con.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36");
con.setRequestProperty("Origin", "");
con.setAllowUserInteraction(true);
con.setRequestMethod("POST");
con.setDoInput(true);
con.setDoOutput(true);

OutputStream os = con.getOutputStream();
BufferedWriter writer = new BufferedWriter(
        new OutputStreamWriter(os, "UTF-8"));
writer.write("{\"function\":\""+phpFn+"\",\"int\":\""+fnParams[0]+"\"}");
writer.flush();
writer.close();
os.close();
con.connect();

same code works for the
Quote
get_services
function of the function_call API.

Offline Grimson

  • Full Member
  • ***
  • Posts: 254
  • Karma: +35/-2
    • View Profile
Re: Server returned HTTP response code: 500 for REST API call
« Reply #1 on: December 19, 2017, 03:38:37 pm »
Trying to block the IP using FauxAPI.

Your best bet is to talk to the author of it, as this isn't an official package.