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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:32:22+00:00 2026-06-05T16:32:22+00:00

I am going to write a restful API, my requirement is to call methods

  • 0

I am going to write a restful API, my requirement is to call methods on “Transaction” object, I was wondering how I should call Post/PUT with appropriate URI template so that I can Create/update the Transaction resource without using “verbs” in Uri mapping.

[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "/Transaction/{**What to write here ????**}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public Transaction AddTransaction(Transaction transaction)
{
    return AddTransactionToRepository(transaction);
}

[OperationContract]
[WebInvoke(Method = "PUT", UriTemplate = "/Transaction/{**What to write here ????**}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] 
public Transaction UpdateTransaction(Transaction transaction)
{
    return UpdateTransactionInRepository(transaction);
}

Please consider that I want to apply best practice for uri mapping and do not want “verbs” in it, only “nouns”. Also tell me how client will access these methods for Post and Put with unique URI. 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-05T16:32:24+00:00Added an answer on June 5, 2026 at 4:32 pm

    You have to map the URIs as below for Transaction.

    Get a transaction by ID – GET – transaction/id

    Create a new transaction – POST – transaction

    Update a transaction – PUT – transaction/id

    Delete a transaction – DELETE – transaction/id

    Your URI templates has to be changed as below

    [OperationContract]
    [WebInvoke(Method = "POST", UriTemplate = "/Transaction", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
    public Transaction AddTransaction(Transaction transaction)
    {
        //
    }
    
    [OperationContract]
    [WebInvoke(Method = "PUT", UriTemplate = "/Transaction/{id}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] 
    public Transaction UpdateTransaction(int id, Transaction transaction)
    {
        //
    }
    

    how client will access these methods for Post and Put with unique URI

    You don’t need unique URI for POST and PUT. There URIs can be same.

    References: http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations

    http://msdn.microsoft.com/en-us/library/bb412172(v=vs.90).aspx

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

Sidebar

Related Questions

I was going to write a long-winded post, but I'll boil it down here:
I've decided that I'm going to write an API for my music site. Something
I'm going to write a templatized implementation of a KDTree, which for now should
I am going to write some web application which should detect user's country and
I guess with what I'm going to write I should first clarify, it's not
I am going to write an application server(RESTFull API) to allow clients to download
I'm going to write a RESTful WCF service with webHttp or basicHTTP bindings-- nothing
I'm going to write a CMS, but right now I'm writing down all my
We are going to write an entire new application for a reservation system. In
I'm going to write my own DAL in C#. I decided to use 'Unit

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.