- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
10-09-2023 09:31 AM
I am currently in the process of planning to upload a custom webpage to my Palo Alto device. However, I would like to automate this process through an API call. I have the HTML content for the webpage stored in a variable and I would like to upload it to the following path. Any references or suggestions in this regard would be greatly appreciated.
The manual update path is as follows:
Device -> Response Page -> URL Filtering and Category Match Block Page
There is already one predefined file in place, so if there's a way to update that without uploading a new file, that would also be acceptable for me.
I would be very grateful for any suggestions or assistance. Thank you in advance.
10-09-2023 01:13 PM
Hi @Indranil-Chowdhury ,
Here is an example for the application block page. https://live.paloaltonetworks.com/t5/api-articles/modify-response-pages-from-xml-api/ta-p/62167
You would only need to modify the syntax to do the same for the URL block page.
For drive-by browsers, here is a cool doc on creating custom response pages. https://live.paloaltonetworks.com/t5/blogs/tips-amp-tricks-how-to-customize-your-response-pages/ba-p... That's where I found the example above.
Thanks,
Tom
10-11-2023 10:15 PM
Thankyou so much for your response.
I am preparing the script for uploading the HML page to box under url category.
I need help to understand where i am going wrong here. I am sharing code below.
$deviceUrl = "https://1.2.3.4:4443/esp/restapi.esp?key=" + $retrieve_token
$htmlContent = @"
<!DOCTYPE html>
<html>
<head>
<title>Custom Response Page</title>
</head>
<body>
<h1>This is a custom response page</h1>
<p>Custom content for the response page goes here...</p>
</body>
</html>
"@
# Convert the HTML content to Base64
$htmlContentBase64 = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($htmlContent))
# Define the XML API request body with the encoded HTML content
$xmlRequestBody = @"
<request>
<system>
<response-pages>
<entry name="Application-block-page">
<html-content>$htmlContentBase64</html-content>
</entry>
</response-pages>
</system>
</request>
"@
$response1 = Invoke-RestMethod -Uri $deviceUrl -Method Post -Body $xmlRequestBody -ContentType "application/xml"
10-12-2023 04:57 AM
Hi @Indranil-Chowdhury ,
If you are not able to discern the error in your code output, I can't help you. I did provide you with the XML URL to upload a page, which you requested.
You could try to use curl or Postman to verify the URL works outside of your script.
Thanks,
Tom
10-12-2023 07:42 AM
can you please help me with curl command to upload the page. It will be helpful.
10-25-2024 03:43 AM
I got the error now. Sorry for the delay in response. I was busy in other assignments and jumping back here. Let me paste my function and the response here. I want to upload in URL FILTERING AND CATAGORY MATCH BLOCK PAGE
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!