Is it possible to Use If statements in Web Services

I was trying to make a conditional web service PATCH. My code is as follows:

[{
    "if": [{
        "in": ["payroll", ""]
    }, {
        "op": "replace",
        "path": "/attributes/3352",
        "value": "13978"
    }, {
        "op": "replace",
        "path": "/attributes/3352",
        "value": "13975"
    }]
}]

It gives me an error that /"/" opperation is not supported. I don't know if the problem is with the If statement, the In statment, or if these opperations are not possible, or I have this coded wrong. Any help would be greately appreciated.

Tags json API
Asked by Michael McCarty on Fri 7/6/18 5:20 PM
Sign In to leave feedback or contribute an answer

Answer (1)

This answer has been marked as the accepted answer
Matt Sayers Mon 7/9/18 9:55 AM

Hi Michael,

You are correct in that we do not support that sort operation. I can't say that I have ever seen JSON with an if in statement, but I can say definitively that the TDX REST API has no concept of checking values via a JSON request if section.

For all of our PATCH endpoints, we only support the following the standard PATCH operators:

  • Add
  • Remove
  • Replace
  • Move
  • Copy
  • Test

You can also refer to our generic API documentation for PATCH requests here:
https://api.teamdynamix.com/TDWebApi/Home/AboutPatching

Let me know if this helps.

 

No feedback