Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Server returned HTTP response code: 500 for REST API call

    General pfSense Questions
    2
    2
    406
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V
      Vaibhav1
      last edited by

      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,

      phpFn = 'easyrule_block_alias_getid' and fnParams='wan' 
      
      
      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

      get_services

      function of the function_call API.

      1 Reply Last reply Reply Quote 0
      • GrimsonG
        Grimson Banned
        last edited by

        @Vaibhav1:

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.