logo
down
shadow

POST request side-effects on RESTful API


POST request side-effects on RESTful API

Content Index :

POST request side-effects on RESTful API
Tag : rest , By : Johannes
Date : January 11 2021, 03:34 PM

seems to work fine I'm building an API that enables clients to send emails to their subscribers. It may be that the subscriber is already registered with an unique id assigned to it. Therefore, a POST /emails/subscribers/:subcriberId endpoint exists that lets the client send an email to the subscriber identified by subscriberId. ,
Is this an acceptable RESTful practice?

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

RESTful POST request, If the record already exists on POST data, do we return 200 OK or 304 Not Modified?


Tag : rest , By : user161314
Date : March 29 2020, 07:55 AM
I wish this help you 304 is intended to be used only for a Conditional GET response, to indicate that the requested content has not changed since the last time the client asked for it. It is not appropriate for a POST response.
For a POST response, use 201 if a new record is created, otherwise use 200 or maybe 409 instead.

RESTful APIs: what to return when updating an entity produces side-effects


Tag : rest , By : Menno
Date : March 29 2020, 07:55 AM
this one helps. You really have 2 options with a 200 status PUT, you can do headers (which if you do, check out this post). Certainly not a bad option, but you would want to make sure it was normalized site-wide, well documented, and that you didn't have anything such as firewalls/F5's/etc/ re-writing your headers.
Something like this would be a fair option though:
HTTP/1.1 200 OK
Related-Tasks: /tasks/11;/tasks/12

{ ...task response... }
HTTP/1.1 200 OK
{
    "data": { ...the task },
    "related_tasks": [],
    "aggregate_status": "PartiallyComplete"
}

Handle side effects caused by duplicate POST requests


Tag : web-services , By : nagre
Date : March 29 2020, 07:55 AM
seems to work fine This a common problem with concurrent users. One way to solve it is to enforce conditional requests, requiring clients to send the If-Unmodified-Since header with the Last-Modified value for the resource they are attempting to change. That guarantees nobody else changed it between the last time they checked and now. In your case, this would prevent A from overwritten B's changes.
For instance, user A wants to change the meeting time. It sends a GET request for the meeting resource and keep the value of the Last-Modified response header. Then, it sends the POST request with the Last-Modified value in the If-Unmodified-Since header. Following your example, this request actually succeeds, but the response is lost.

Sending a POST request to my RESTful API(Python-Flask), but receiving a GET request


Tag : python , By : Luciano Campos
Date : March 29 2020, 07:55 AM
it should still fix some issue Make sure you're using the right protocol. http or https.
If you use http and see a redirect, the redirect Location header will have the correct URL usually.

Testing React Hooks side effects that depends on other side effects (or other tests)


Tag : reactjs , By : Hibame
Date : March 29 2020, 07:55 AM
wish helps you One thing you could do is replace the
with a
and add the onSubmit={e => apiRequest(value)} to it so the button can remain disabled and you can still move forward with your tests without introducing unnecessary external factors.
Also, move your function apiRequest() {...} outside of the component. It can take value as an argument instead of relying on the surrounding scope.
// You could even export this separately and make a test exclusively for this
// without also having to test the form itself
function apiRequest ( value ) {
    if (!value) {
      return
    }

    axios.get('url')
      .then(console.log)
      .catch(console.log)
}

function MyComponent() {
  const [ value, setValue ] = useState('')

  return (
    <form onSubmit={e => { e.preventDefault(); apiRequest(value); }}>
        <input onChange={e => setValue(e.target.value)} value={value} />
        <button disabled={!value}>
            Submit
        </button>
    </form>
  )
}
Related Posts Related QUESTIONS :
  • Yii2 restful not working
  • How to design REST API for export endpoint?
  • Backbone.js getting data on POST request
  • What Response Code to return on a non-supported HTTP Method on REST?
  • Rest resource error in WSO2 dataservice with procedure with out param
  • In Karate DSL, How do I resolve an Unsupported Media Type for a valid POST REQUEST
  • Browser test tool for OAuth2 "Client Credentials Flow"
  • Google dialog flow REST API timeout
  • Rename a label on Github with curl
  • MapBox - How the get Points of Building Shape/Edge
  • Passing URL as an environment variable in docker run
  • HTTP method to use when processing client data to produce output
  • Use PowerShell to destroy source code marked for deletion in TFS, is this possible?
  • How to upload images using postman to azure blob storage
  • why HTTP method delete and put considered idempotent?
  • Platform specific deserialisation in golang?
  • Are Flask client side session stateless?
  • How to add query string parameter to FakeRequest in Play Framework 2.3?
  • How to set page layout of list item in SharePoint REST?
  • When PUTting with an id in the URL and in the body, which one wins?
  • Optimistic locking: modifying a resource using another resources
  • API: GET-request with user_id or name+region
  • RESTful API - Can't decide which route form to use
  • REST API design of resources with many operations based on the resource status
  • REST: Is the nonexistence of a request body already enough to distinct two different methods?
  • SoapUI, request body in get method?
  • What is discovery based in Rest API
  • Popcorn API: How to enable expansion on a custom translation?
  • Create request in JIRA from Jenkins
  • How to create a H2OFrame using H2O REST API
  • Spring Boot Application: No converter found for return value of type
  • Twitter API code 32 401 unauthorized via postman
  • ASP.NET Web Api duplicate verbs
  • VSTS connection with SOAPui via ReSTapi
  • Change restangular url so that it doesn't go to a concatenation of localurl+serverurl?
  • Adding customer_balance_amount to Magento 2's Order REST API
  • REST URL Design for Many to Many Relationship
  • Grails installing REST client plugin
  • REST api vs REST Webservice vs RESTFul web service
  • HTTP Caching for authenticated REST apis
  • How to configure confluent kafka rest serializer?
  • SPLUNK multi-value chart
  • Are complex searches inherently not RESTful?
  • What should be validated first token or parameters?
  • Authorizing access to resource in a REST API
  • REST best practice cloud
  • Swagger errors shows a need to define a parameter in the path or operation level
  • Create a Dataset in BigQuery using API
  • Microservices "JOIN" tables within different databases and data replication
  • Should Content-Type header be set for 404 and 204 responses?
  • MarkLogic 9 resource extension API not working without rs: namespace prefix
  • Query parameters AND and OR differentiation
  • TestCafe script, how to call a restApi (which uses keycloak)
  • Perl version of this python servicenow script posting a file
  • REST API convention for subresource
  • Is it good to return HTTP 500 in a RESTful API?
  • How to find rest call made by powershell cmdlet?
  • Is a GraphQL API RESTful by default?
  • How to design HTTP API to push massive data?
  • Spring MVC REST not null constraint does not work on missing request param
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com