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 6723165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:32:11+00:00 2026-05-26T09:32:11+00:00

Basically I written a REST service and my business logic requires me to validate

  • 0

Basically I written a REST service and my business logic requires me to validate the input. For instance make sure the format of phone number is (###)###-####. If it is not, it should return invalid phone number. Further more I need to record all actions of the service. So when the client queries the system, they can find out what was the last action. I.e:

ACTION: ADD – SUCCESS
ACTION: ADD – INVALID PHONE NUMBER

So now I’m thinking whether I need to create my own custom error codes or just use the default HTTP ones and also record those inside the “log”

Pretty new to REST style so if my logic is off let me know…

So should I…

public void callPerson(String phone)
{
    try
      validate(phoneNumber)
      call person
    catch
        throw Invalid Phone Number
    finally
       record status to DB
}

or

public myStatusCode callPerson(String phone)
{
    try
      validate(phoneNumber)
      call person
    catch
        return myStatusCode
    finally
       record status to DB

}

In fact I also want to make sure the status gets recorded as well other wise it would not be good if say the action worked but the status update didn’t. So updating the status should really be part of the “transaction”

Also another thing to keep in mind this REST service some of the actions have to communicate with an older “message” oriented service where the response and error code are in the XML response message…

Any suggestions? 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-05-26T09:32:12+00:00Added an answer on May 26, 2026 at 9:32 am

    I would recommend a HTTP status code 412 (Precondition Failed) and a String message for the error.

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

Sidebar

Related Questions

I've written a Windows Service in C# that basically checks my db every minute
I've written a number of methods (.WhereOr, .WhereAnd) which basically allow me to stack
I've written a couple simple GUI applications but all of the logic is basically
Basically I've written this program to check for strings. I've used socket method for
I've written a script to geocode some points which has a structure basically like
I have written a custom class for overriding the seek method of QSlider. Basically
I have a custom component called ButtonPanel written in Actionscript. Basically it's just a
basically I want to validate whether or not a text box is a certain
Basically I have written a game plugin that will allow server admins to update
Basically I have written a script to allow the user in the back end

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.