Droptext.cc – Free Anonymous Text Hosting

Share your text data anonymously and free



Problem Statement: To create a common request and response function for the below-mentioned APIs.
Requirements:
 How to create an API/ WebMethods in asp.net c#
 How to make a WebRequest to external API from c#
 How to Parse, Serialize/Deserialize and Replace the content in JSON Object using System.Text.Json or
NewtonSoft Library
API Signature : call_external_api(string url,string api,string filter)
 url : Mandatory, string parameter that will be sent by client/postman containing 3
rd party base url
 api : Mandatory, string parameter that will contain the api to fire
o Final path external API will be url/api
o Example : https://api.publicapis.org/entries
 filter : Optional, string parameter, ignore if empty, else filter the output of 3rd party api based on this value
and pass it back to api response
Steps:
1. Request will consist of Url, API Name (Mandatory) and Filter Parameter (Optional).
2. Send a request from Postman which will internally call API depending on which api passed in Request.
3. For Response body, Filter the response from external api with query string.
4. Parse and save the Json body.
5. Send a Response on Postman in Json Format.
6. If time permits : 4th and 5
th parameter “replaceKey” & “replaceValue”, example, Replace all values of
“HTTP” from “True” to “False” for a given Category (filter)
Note: Only use System.text.Json / NewtonSoft library. Don’t use any third-party library



Views: 9, posted on: 2023-02-27