C
C#7mo ago
_vegabyte_

✅ Proper implementation of API

Hi guys, so I have a client registration implementation. The client should input their Personal Information, Terms and Conditions, and add some valid documents. I divided them to 3 APIs, AddPersonalInfo, AddTermsAndCondition, AddAttachments. Since the informations is needed to provide all at once it means I will calling the API one by one, one after another. Do you guys think it's good practice? Or is there any another approach for this implementation. My concern is what if one of the API is failed, the saving should not be completed and be voided. Your suggestion are well appreciated. Thanks
6 Replies
Angius
Angius7mo ago
Why is it three different calls, exactly...? I'd think it can all be one form, and one payload Or, at least, user info + ToC acceptance should be one thing Then you have a complete user, that can have an "invalid" state Then, when they upload valid documents, the state changes to "valid"
_vegabyte_
_vegabyte_7mo ago
My primary reason is Personal info and ToC for me is different. So i decided to create different APIs. Yeah, since I'm already saving sa personal info and Terms, is there any good approach like when the user is in the Uploading section and canceled the registration it will delete the Personal Infos and ToC? Because the primary reason for this is the Information is already on the database and if the user try to add the same info again it will be getting some validation errors.
Angius
Angius7mo ago
You can detect the user clicking some "cancel" button, but not so much if the user closes the tab or the browser Your best bet would be a timer If no valid documents are uploaded within 5/10/15/whatever minutes, delete the data
_vegabyte_
_vegabyte_7mo ago
Ohh yeah, maybe I will check the database for the clients that has no document yet within that time frame it will delete the data related to that client. What do you think?
Angius
Angius7mo ago
Yep Some sort of a CRON job that runs every now and then, checks the user creation date, and if it's older than X minutes and the user has status "invalid", delete the data
_vegabyte_
_vegabyte_7mo ago
Okay, It is now clear to me how to adjust my API, I'll try to merge AddPersonalInfo and ToC. Thank you very much!!!
Want results from more Discord servers?
Add your server
More Posts
❔ Closing C# Winforms In all computers?Well, basically what I want is a button that when clicked will close the application on all computer❔ Cross platform user settings for app.If I want to set and read user settings for my application, what would be the best way to do that in❔ returning an array from a substringusing System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T✅ Creating new cancellation token from multiple other tokensI've got function that is being passed in a cancellation token, and I want to cancel an inner functi✅ oauth in asp net framework?hi all, i have created a redirect url for oauth clients how can i redirect my deployed asp net pro❔ Best, most reliable NER (Named Entity Recognition) Library for .NET?I'm looking for a NER library that is supported with .net framework & .net core. I do not want to ❔ Organized Function / method libraries?In C# i want to try making some reusable methods/functions. In Unreal Engine, there is a "Function L✅ How do you control which WPF property is the default for that class?Examine the following XAML: ```XAML <SomeClass> PropertyValue </SomeClass> <OtherClass> <OtherCl❔ ✅ WPF Class derivation where both classes have XAML pagesIs it OK for base WPF class to have a XAML page and its derived class to also declare one? So we'd ❔ Adding up checkBoxes and Radio Buttons into list boxhttps://gyazo.com/797f6e3e82d121c43a5895520421ebb3 This is my form looking for some help getting my