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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:57:34+00:00 2026-05-23T12:57:34+00:00

Let’s say I have a trip planning application, and each trip is composed of

  • 0

Let’s say I have a trip planning application, and each trip is composed of “path” resources (representing a route to be driven, for example) composed as a series of points. I can CRUD these resources using requests like so (just an example):

POST /trips/1234/paths

<Path>
  <Point>32,32</Point>
  <Point>32,34</Point>
  <Point>34,34</Point>
</Path>

DELETE /trips/1234/paths/3

Now consider that I want to be able to split a Path into two paths. In the aobve example, I might want to pick the point (32,34) to split on, which would result in two paths – one ends at that point, one starts at that point. What this means is that a single action creates two new resources, and simultaneously, deletes another (the path that was split).

So if the path in the example above was the only path in the system, and I split it with a single call, the system would now contain two new paths and the original would be gone. Example:

<Path>
  <Point>32,32</Point>
  <Point>32,34</Point>
</Path>

<Path>
  <Point>32,34</Point>
  <Point>34,34</Point>
</Path>

I’m struggling with how this would be handled RESTfully. How does one handle calls that result in multiple resources being created/modified/deleted and communicate that to the caller?

I can definitely figure it out with multiple calls (two POSTs to create the new paths and a DELETE to remove the original), but I want this to be a single call.

  • 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-23T12:57:34+00:00Added an answer on May 23, 2026 at 12:57 pm

    I would try to implement it like @Darrel Miller’s answer yet make it a little less RPCish.
    The idea is to create a PathSplit resource that guides the client each step of the way to complete the transaction. This way the client knows the result of each step and knows hows to back out if there is an error along the way.

    Something like this should do the trick.

    POST /pathsplit HTTP/1.1
    Content-Type: application/vnd.acme.pathsplit+xml
    <pathsplit xmlns="http://schema.acme.com">
      <path>
        <id>123</id>
      </path>
      <splitpoint>
          <point>32,34</point>
      </splitpoint>
    </pathsplit>
    
    =>
    HTTP/1.1 201 Created
    Content-Type: application/vnd.acme.pathsplit+xml
    Location:
      http://acme.com/pathsplit/11
    
    <pathsplit xmlns="http://schema.acme.com">
      <path>
        <id>123</id>
      </path>
      <splitpoint>
          <point>32,34</point>
      </splitpoint>
      <newpaths>
        <Path>
          <Point>32,32</Point>
          <Point>32,34</Point>
        </Path>
        <Path>
          <Point>32,34</Point>
          <Point>34,34</Point>
        </Path>
        <createuri>http://acme.org/trips/paths</createuri>
      </newpaths>
      <oldpath>
        <uri>http://acme.org/trips/paths/123</uri>
      </oldpath>
        <status>in-progress</status>
        <pathscreated>0</pathscreated>
    </pathsplit>
    

    With something like this the client can always GET the pathsplit resource to see what actions to take. In this example it would create both new paths following the createuri link and sending a POST request for each new path in newpaths. The server updates the status as each new resource is created.

    Once the status has pathscreated of 2, the client can delete the old path by following the uri and sending the DELETE verb. Finally, it would delete the pathsplit resource, thus indicating that everything succeeded.

    At every step along the way, in case of an error, or in the all too common case of a network outage, the client always knows what state the server is in and what state the transaction is in.

    The pathsplit resource remains available as long as the transaction hasn’t completed.
    The client also has the option of reverting a transaction that has not yet completed. Again, since it knows what operations have completed successfully and which haven’t, it can always back out the transaction.

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

Sidebar

Related Questions

Let's say I'm building a data access layer for an application. Typically I have
Let's say I have a text file composed like this ##### typeofthread1 ##### typeofthread2
Let's say I have the following text: (example) <table> <tr> <td> <span>col1</span> </td> <td>col2</td>
Let's say I have an facebook application running using the JS SDK. First user
Let me frame it this way.. Say I have an application server running on
Let's say I have two assemblies: BusinessLogic and Web. BusinessLogic has an application setting
Let's say for example i have URL containing the following percent encoded character :
Let's say you have a class called Customer, which contains the following fields: UserName
Let's say we have a simple function defined in a pseudo language. List<Numbers> SortNumbers(List<Numbers>
Let's say I have a drive such as C:\ , and I want to

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.