REST API design for endpoint with notification - api

I am creating an API endpoint which takes a customer order, create the order and send email notification. At our current design once we successfully create the order, we send a success notification 201 to client and then make a call for our internal email api. Upon getting success notification from us the client app shows users a message to check his/her email.
I don't feel comfortable with this design because if for some reason the email sending method failed there are no way for client to understand this. On the other hand if we wait for to successfully the send the email and then send client app success notification it takes longer times.
So what is the right approach for overcoming this problem?

I think your design works. Why would the client care if the mail service is not working? If the order passes all validations on the server and is persisted I would treat that as a successful state and return 201 Created.
When the client gets 201 Created, then do what you say; give the user a message about checking their mail, but tell them that they should have some patience. Something like:
Your order was submitted. Please check your mail. If you haven't got a mail in 24 hours please contact us, "or whatever other solution here".
You have no control on what time the mail will arrive at the users mail box anyway since mail sending is not a synchronous process.
Remember: Seperate your conserns.

202 Accepted would usually be the most appropriate response for a request which requires further processing. In your case, however, this might not be right because the email is not fundamental to the resource creation.
201 Created is perfectly acceptable for you because the order has actually been created. However, as the spec says, you should return a Location header with the URI of the created resource and an entity describing how to access the resource. That should get around your issue with a mail service failure - the client can still access their order and, to be honest, e-mail is not guaranteed delivery so I'm hoping that the email isn't an absolutely required part of your business process.

Related

Uber API Reporting: Reference between Report Request and Report Success Notification

We want to generate Uber Eats reports for multiple customers. Since everything is running on one system, the webhook notification for report generation will all arrive on the same local API.
Now wondering if there is a relation between the webhook notification and the original report request?
The reason is that we would like to check the signature of the notification and for this we need the appropriate client secret. Also we want to mark the original report request as completed.
So we need to be able to associate the notification to the right client or at least to the report request.
Is it possible that the workflow id we receive with the report request is included in the notification?
Or is the job_id what I'm looking for? In the notification example this is not so clear to me.
Do you have other ideas here?

Maximo script to send a message to another user?

With IBM ICD/Maximo version 7.6.1.2 I am trying to inform a user when an attachment (arriving via a REST call) has finally arrived.
I have access to the USERID of the requester
the launchpoint is 'add' on DOCLINKS
I aim to inform the user using a message box (or something similar) if he/she is still active on the platform
The whole send/receive action takes more than 10-15 minutes so waiting for a response during the same REST call is not possible. The user sends a POST and later receives a POST.
The problem is, mbo.getUserInfo() points to the username of the external service and not the requester so in my opinion I need to either change the active session or active user in order to be able to use commands like:
service.webclientsession().showMessageBox(msggroup,msgkey,params)
I need a method or commands to do that.
One possible way to do this would be by sending a bulletin board message to the user to notify that their file has been uploaded as shown here

Send message to th all of bots users (telegram api)

how to send Send message to the all of bots users?
There is no way to sned message to all ?
what is the method name ?
From Official API FAQ:
How can I message all of my bot's subscribers at once?
Unfortunately, at this moment we don't have methods for sending bulk messages, e.g. notifications. We may add something along these lines in the future. (...)
Obviously, if you store users chat_id, you can send individual message to all users (I use this method).
Navid wants to send message to all subscribers via bot.
If subscribers are more than 100 persons bot will very slow to sending all messages and may doesn't send messages to all.
Navid's question was how we can send message without this problem?
you can send with curl_multi_exec
Currently, a developer would need to implement a special broadcasting function that would send the message to each active user at the time adding a small delay to avoid hitting the rate limit of 30 messages per second (see https://core.telegram.org/bots/faq#how-can-i-message-all-of-my-bot-39s-subscribers-at-once). This would mean that a very popular bot with say 10K active users cannot give timely notification as the last user would get the message about 5 minutes after the first user.
Here is a feature request to ask to add a method in the Bot API to broadcast a message to all its active users at once. You can upvote this feature request. https://bugs.telegram.org/c/8463

Detection job run, no notification emailed

When starting a duplicate detection job, I'm checking notify when done. After the job's finished, no email is received at the address mentioned at the start of the job. I'm logging in using AD and authorization is done the same way as Exchange is using, so I expected the email to work.
I tried to approve the mail recipient (me) when creating the user. To no avail.
What am I missing?
So seems like they are just not being send. You have to either set up email router, server side sync or have outlook with plugin. On user record you have to tell which method do you use. For users with OWA router or server-side would be only options.
Server-side is new in 2013. It can replace email router, so all email processing is done by async service.

MailChimp/Mandrill webhook for message created/scheduled

Is it possible to get MailChimp or Mandrill to notify a webhook URL whenever a message is either created for a list, or scheduled to be sent, along with the list and message IDs?
I have a client that wants to intercept messages from his campaign, add special data from his server, then send the resulting template through his connected Mandrill account. I'm trying to figure out how to implement the first step in this process.
Although I know this is old someone may stumble into this thread, have you checked out the webhook information?
http://help.mandrill.com/entries/58303976-Message-Event-Webhook-format
It has an easy way to implement it inside the account. You just setup a URL to intercept and parse the incoming data. I recommend first saving the data then using a scheduled task to parse the job separately so you don't lose data (although mandrill will try 100x).
If the unique id is not enough for you with your events, and you are concerned about specific campaigns you can tag the emails upon send and they will have the tagged information with the incoming event.