dimanche 24 mai 2020

Condition based API url in JSON

I am using a JSON to make a call to some APIs. My sample JSON is something like :

{
  "call": [
    {
      "url": "https://URL",
      "httpMethod": "POST",
      "httpHeaders": {
        "Accept": "application/json",
        "Content-Type": "application/json"
      },
      "httpContentType": "application/json"
    }
  ]
}

My requirement is to select the URL based on some condition. For example, if employeeType='Employee' the url in the above JSON should be https://URL1 and if employeeType='Contractor' then the url should be https://URL2.

Is this possible to achieve? and how?

Aucun commentaire:

Enregistrer un commentaire