Aspose Error when trying to sign document

Aspose _ result:: Error 405 HTTP method POST is not supported by this URL

HTTP ERROR 405 HTTP method POST is not supported by this URL

URI:/api/v2/ProcessCourtFiles
STATUS:405
MESSAGE:HTTP method POST is not supported by this URL
SERVLET:EPAgentLegacy

@ttseabi

:raising_hand_man: Hello!

I’m sorry to hear you’re getting a 405 – HTTP method POST is not supported error when trying to sign a document with Aspose.

Below is a checklist of common reasons for this response when using the Aspose Cloud REST API, together with the steps to resolve them.


:clipboard: Quick Checklist

# What to Verify How to Check / Fix
1 Correct HTTP verb – the ProcessCourtFiles endpoint is a GET operation, not POST. Change your request to GET or use the proper signing endpoint (/api/v2/sign) if you intend to post a document.
2 Endpoint URL – ensure you are calling the right path for the operation you want (e.g., /api/v2/sign for PDF signatures). Compare your URL with the Aspose Cloud API reference for the product you are using (PDF, Words, etc.).
3 Base URL – the request must be sent to https://api.aspose.cloud (or the region‑specific endpoint you subscribed to). Verify the base URL in your client configuration.
4 Authentication – a valid Authorization: Bearer <access_token> header is required. Generate a fresh access token via the OAuth endpoint and include it in the request.
5 Request body – when posting a document, the body must be either JSON (for parameters) or a multipart/form‑data containing the file. Use the example payload from the docs for the signing method you are using.
6 Content‑Type header – set to application/json (for JSON) or multipart/form-data (for file upload). Double‑check the header values in your HTTP client.
7 API version – you are using /api/v2/…. Make sure the resource exists in v2. If the endpoint was introduced in v3, switch to /api/v3/….

:wrench: Typical Code Samples

Below are minimal, working examples for signing a PDF with Aspose PDF Cloud (C# and cURL). Adjust the endpoint if you need a different product.

C# (Aspose.Pdf.Cloud SDK)

using Aspose.Pdf.Cloud.Sdk.Api;
using Aspose.Pdf.Cloud.Sdk.Model;

// 1️⃣ Initialise the API client
var config = new Configuration
{
    ClientId = "<your-client-id>",
    ClientSecret = "<your-client-secret>"
};
var pdfApi = new PdfApi(config);

// 2️⃣ Prepare the signature options
var signature = new Signature()
{
    // Example: text signature on the first page
    Text = new TextSignature()
    {
        Text = "Approved",
        Location = new Location() { X = 100, Y = 100 },
        FontSize = 12,
        FontColor = "Blue"
    }
};

var options = new SignDocumentOptions()
{
    Signatures = new List<Signature> { signature },
    OutputFileName = "SignedDocument.pdf"
};

// 3️⃣ Upload the original file (if not already in storage)
pdfApi.UploadFile(
    path: "Temp/Original.pdf",
    file: File.ReadAllBytes("Original.pdf")
);

// 4️⃣ Call the SIGN API (POST)
var response = pdfApi.SignDocument(
    name: "Original.pdf",
    options: options,
    folder: "Temp"
);

Console.WriteLine($"Signed file saved as: {response.Path}");

cURL

# 1️⃣ Get an access token
curl -X POST "https://api.aspose.cloud/connect/token" \
     -d "grant_type=client_credentials&client_id=<client-id>&client_secret=<client-secret>" \
     -H "Content-Type: application/x-www-form-urlencoded"

# → copy the access_token from the response

# 2️⃣ Upload the PDF (optional if already in storage)
curl -X PUT "https://api.aspose.cloud/v2.0/pdf/storage/file/Temp/Original.pdf" \
     -H "Authorization: Bearer <access_token>" \
     -H "Content-Type: application/octet-stream" \
     --data-binary "@Original.pdf"

# 3️⃣ Sign the PDF
curl -X POST "https://api.aspose.cloud/v2.0/pdf/Temp/Original.pdf/sign" \
     -H "Authorization: Bearer <access_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "signatures": [{
               "text": {
                   "text": "Approved",
                   "location": { "x": 100, "y": 100 },
                   "fontSize": 12,
                   "fontColor": "Blue"
               }
           }],
           "outputFileName": "SignedDocument.pdf"
         }'

Note: Replace v2.0 with v3.0 if you are using the latest API version.


:open_book: Where to Find the Docs


:bellhop_bell: Next Steps

  1. Confirm the exact operation you are trying to perform (signing, uploading, processing, etc.).
  2. Check the HTTP verb – use POST only for endpoints that explicitly support it (e.g., /sign, /convert).
    If you really need to call /api/v2/ProcessCourtFiles, switch to GET or the correct endpoint for signing.
  3. Update your request according to the checklist and code samples above.
  4. Run the request again and let me know:
    • The full request (URL, headers, method) without sensitive tokens, and
    • The exact response you receive (status code and body).

If you share a short snippet of the code you are using (C#, Java, Python, etc.), I can point out the precise line that needs adjustment.


Feel free to reply with the additional details, and I’ll help you get the signing workflow working smoothly! :rocket:

@ttseabi, Hi
Please provide sample code and input file to reproduce issue. Which sdk do you use to interract with cloud api?