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

  • Home
  • SEARCH
  • 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 7840123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:39:59+00:00 2026-06-02T15:39:59+00:00

I’m planning to make an API (as a web service) for validating user input.

  • 0

I’m planning to make an API (as a web service) for validating user input.

The API gets 3 parameters from a user as input, checks all the parameters are valid, then returns the result (ex: true or false) to the user.

And here’s a rough sketch for the API (I doubt this is RESTful):

URL: http://my.domain.com/validate/v1 (POST)
Required parameter: param1, param2, param3
Result: To response body (XML/JSON) or response header (HTTP status)

But after googling API design and REST I found that something’s wrong with this API design.

According to Wikipedia, Requests and responses are built around the transfer of representations of resources. But the API I’m making has nothing to do with resources. It doesn’t CRUD any resources. All the API does is just taking inputs, validating them, and returning the result. And I’m stuck on designing the API with this requirement.

Any advices/corrections to this question are welcomed.

  • 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-02T15:40:02+00:00Added an answer on June 2, 2026 at 3:40 pm

    You are right that your problem better fits the RPC style, but it can be nevertheless easily mapped to REST. Here is how I would do it:

    The POST method is frequently used in REST to create a new resource. The representation of this new resource is posted to an URL representing a collection of resources of the same type. If the operation is successful, the HTTP status code “201 Created” is returned with the representation in the repose body (essentially the same message body as the one sent in the post). The Content-Location header returned shows the URL assigned to the new resource. If the operation fails, it is signaled with a “400 Bad Request” status code and a more detailed human-readable error description in the message body.

    As you can see, validation is already part of this common REST pattern. By what I understand, the only difference in your case is that you don’t want to create (remember) this resource on your server. So don’t. REST doesn’t say you must. If you find it easier, imagine that the resource was indeed temporarily created but immediately deleted afterwards. Return the status code “200 OK” if the parameters pass validation and also return the parameters in the message body. Return “400 Bad Request” otherwise.

    If the verb “validate” bothers you in the URL (it shouldn’t), name the URL something else, perhaps something that would be an appropriate name for an object made up of the three parameters.

    Hope this helps

    Ferenc Mihaly
    http://theamiableapi.com

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.