Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8720427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:02:24+00:00 2026-06-13T07:02:24+00:00

I’m attempting to expose a RESTful URL that returns a multi page document. With

  • 0

I’m attempting to expose a RESTful URL that returns a multi page document. With a PDF it’s quite simple in my opinion.

GET /documents/12345.pdf

But I also wish to expose the same document with an image format where each page is a separate jpg. How would I best go about constructing the URL?

So far I’m torn between

GET /documents/12345/page1.jpg

or

GET /documents/12345.jpg?page=1

or

GET /document/12345?page=1&type=jpg

I know there is no absolute right way to do this I’m just looking for what is most intuitive. I’ve spent so much time looking at this that I can’t tell which one I like best or even if there is an alternate approach that would be better.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:02:25+00:00Added an answer on June 13, 2026 at 7:02 am

    The Resource

    Your resource is the document. The PDF and JPEG are two representations of this resource. So both are available under

    /documents/12345
    

    Content Negotiation

    How does the client select the PDF or the JPEG? That’s what the HTTP header Accept is for.

    GET /documents/12345
    Accept: image/jpeg
    

    for the JPEG represenation,

    GET /documents/12345
    Accept: application/pdf
    

    for the PDF represenation.

    Pages

    Now we still have the problem of pages. Here I would recommend to follow the approach mentioned in the comments:

    GET /documents/12345/1
    Accept: image/jpeg
    

    for page 1 of the JPEG represenation.

    Problems

    There still is a small problem: What happens with this request?

    GET /documens/12345/1
    Accept: application/pdf
    

    Is there ‘page 1’ of the PDF representation as a separate entity? Perhaps there is, if your RESTful service can generate it.

    But we are not finished. What happens with this request?

    GET /documents/12345
    Accept: image/jpeg
    

    Is there a single-page version of the JPEG representation? Again, perhaps there is, if your RESTful service can generate it. Perhaps it could generate a all-pages-on-one-page JPEG. If it can’t, return 404 Not Found.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.