[英]How to automatically make POST REST API requests in c#
I have a project scenario that requires me to make POST REST API requests to url endpoints automatically, so basically I have a view/table in my SQL database and I want to iterate through that view/table to find what changed for a specific column(email) and make a POST request to update only what was changed from view/table columns in SQL and update the JSON in the url endpoint for column(email) This needs to be done automatically either daily, weekly, or monthly. I have a project scenario that requires me to make POST REST API requests to url endpoints automatically, so basically I have a view/table in my SQL database and I want to iterate through that view/table to find what changed for a specific column(电子邮件)并发出 POST 请求以仅更新从 SQL 中的视图/表格列更改的内容,并更新 url 中的 JSON
Here is a snippet of JSON structure and the column that I want to overwrite is (emailAddress)这是 JSON 结构的片段,我要覆盖的列是 (emailAddress)
{ "additionalAddressInformation": "", "addressLine": "ADF Test Street", "addressLine1": "", "alternatePhone": "", "city": "TEST", "companyLocationID": null, "countryID": 00, "emailAddress": "adftestingautotask@test.com", "emailAddress2": null, "emailAddress3": null, "extension": "", "externalID": "", "facebookUrl": "", "faxNumber": "", "firstName": "Azure Data Factory", "isActive": 0, "isOptedOutFromBulkEmail": false, "lastName": "Azure", "linkedInUrl": "", "middleInitial": "B", "mobilePhone": "", "namePrefix": null, "nameSuffix": null, "note": "", "receivesEmailNotifications": true, "phone": "(000) 000-000", "primaryContact": false, "roomNumber": "", "state": "NY", "title": "ADF Developer", "twitterUrl": "", "zipCode": "0000", }
What I have done so far:到目前为止我做了什么:
Yes, HangFire is one of the methods - if you prefer creating an app that takes care of it's own and just runs on server - it's more then enough.是的,HangFire 是其中一种方法——如果你更喜欢创建一个自己处理并在服务器上运行的应用程序——这就足够了。
Alternative approach would be to use tools like Jenkins to schedule a repeating task on the server side.另一种方法是使用 Jenkins 等工具在服务器端安排重复任务。
It all depends in this case on preference and available resources - more complicated but self-sufficient app vs simpler app that just scan the db and use post fired up by third party solution.在这种情况下,这一切都取决于偏好和可用资源 - 更复杂但自给自足的应用程序与仅扫描数据库并使用第三方解决方案启动的帖子的简单应用程序。
And please, do mind that my answer is opinion-based - I don't think that there is a one proper way of handling this situation without going into much detail.请注意,我的回答是基于意见的——我认为没有一种适当的方法可以在不详细说明的情况下处理这种情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.