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

Server returned HTTP response code: 500 for REST API call

Scheduled Pinned Locked Moved General pfSense Questions
2 Posts 2 Posters 406 Views
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 Dec 19, 2017, 8:12 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,

    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
    • G
      Grimson Banned
      last edited by Dec 19, 2017, 9:38 PM

      @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
      2 out of 2
      • First post
        2/2
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
        This community forum collects and processes your personal information.
        consent.not_received