Potential API Bug?

I’ve been looking at some of the new APIs and I think I found a bug here:

Sending that call with no filter gives me 2 objects in the response body. If I apply a filter of medium eq "EMAIL" then I get 0 objects even though both templates have a medium type of “EMAIL”.

I’ve also looked at /notification-template-defaults/ and it does not exhibit the same behavior.

Hey Adam,

This is interesting… I am not able to reproduce this in our tenant.

I created two email notification templates with the medium email.

[
    {
        "id": "706415cf-2c7d-4c0a-8b75-6120ec503b80",
        "created": "2024-03-14T13:49:09.133Z",
        "modified": "2024-03-14T13:49:09.147Z",
        "medium": "EMAIL",
        "key": "cloud_manual_work_item_summary",
        "name": "Pending Task Daily Digest",
        "description": "If enabled sent to users daily when they have incomplete tasks in their Task Manager.",
        "locale": "en",
        "subject": "#set($numberOfPendingTasks = $__numberTool.integer($numberOfPendingTasks))#set($taskTasks = \"#if($numberOfPendingTasks == 1)task#{else}tasks#end\")\nYou have $numberOfPendingTasks $taskTasks to complete in ${__global.productName}.",
        "header": null,
        "body": "Dear $__recipient.name,<br /><br />#set($numberOfPendingTasks &#61; $__numberTool.integer($numberOfPendingTasks))\n#set($isAre &#61; &#34;#if( $numberOfPendingTasks &#61;&#61; 1)is#{else}are#end&#34;)\n#set($taskTasks &#61; &#34;#if( $numberOfPendingTasks &#61;&#61; 1)task#{else}tasks#end&#34;)\n#set($url &#61; &#34;${__global.productUrl}/ui/main#launch:tasks&#34;)\n\nThere $isAre $numberOfPendingTasks $taskTasks waiting for you in your $__global.productName Task Manager.<br /> Use each task&#39;s details to finish it on the source, then mark it as complete in ${__global.productName}. To do this work, go to the task manager <a href=\"$url\">here</a>, or copy and paste this link into your browser: $url<br /><br />Thanks,<br /> The $__global.productName Team<br />",
        "footer": null,
        "from": "$__global.emailFromAddress",
        "replyTo": "$__global.emailFromAddress",
        "slackTemplate": null,
        "teamsTemplate": null
    },
    {
        "id": "01a0778e-89b4-450c-9485-b6b8600e0dbf",
        "created": "2024-03-14T13:40:58.403Z",
        "modified": "2024-03-14T13:40:58.426Z",
        "medium": "EMAIL",
        "key": "non_employee_request_created",
        "name": "Non-Employee Request Created",
        "description": "Sent to a non-employee account manager to confirm that their request for a new account for a non-employee was submitted.",
        "locale": "en",
        "subject": "You’ve requested a non-employee account for ${data.firstName} ${data.lastName}",
        "header": null,
        "body": "Dear $__recipient.name,<br /><br />#set($_sourceName &#61; $data.nonEmployeeSource.name)\n#set($_approverIds &#61; $__util.getObjectByJsonPath($__contentJson, &#39;$.data.approvalItems[*].approver.id&#39;))\n\n<p>Your request for a non-employee account for $data.accountName on the source $_sourceName was successfully submitted.</p>\n#if($_approverIds.size() &gt; 0)\n    #if($_approverIds.size() &#61;&#61; 1)\n        <p>$__util.getUser($_approverIds[0]).name must approve this account request before it can be added to the source.</p>\n    #elseif($_approverIds.size() &gt; 1)\n    <p>The following reviewers must approve this account request before it can be added to the source:</p>\n    <ul><li>\n        #foreach($_approverId in $_approverIds)\n            </li><li>$__util.getUser($_approverId).name</li><li>\n        #end\n    </li></ul>\n    #end\n<p>You will be notified when a decision is made about this account request. You can check the status of your request by clicking Manage Non-Employees on the dashboard and viewing the $_sourceName source.</p>\n#{else}\n<p>\n    This account will be added to $_sourceName shortly. You can check its status by clicking Manage Non-Employees on the dashboard and viewing the $_sourceName source.\n</p>\n#end\n<br />Thanks,<br /> The $__global.productName Team<br />",
        "footer": null,
        "from": "$__global.emailFromAddress",
        "replyTo": "$__global.emailFromAddress",
        "slackTemplate": null,
        "teamsTemplate": null
    }
]

If I call postman with the filter it does filter it correctly.

Filtering on EMAIL

Filtering on SLACK, nothing shows up as I would expect.

If you are calling the same thing in your tenant and get incorrect results something else may be going on. In that case I would file a support ticket.

That’s interesting. I’ve tested this on both of our partner tenants along with my ambassador tenant and all 3 exhibit the behavior I’m seeing.

https://devrel-ga-5696.api.identitynow-demo.com/beta/notification-templates?count=true&filters=medium eq "EMAIL"

Now I am puzzled…

Can you send the output from the request in the postman console on the right hand side there should be a show raw log. Before you send it make sure you remove the Bearer Token

Below is my personal tenant and I get correct results there too…

GET /beta/notification-templates?filters=medium%20eq%20%22EMAIL%22&count=true HTTP/1.1
User-Agent: PostmanRuntime/7.36.3
Accept: */*
Postman-Token: 514be9c5-56c4-4d64-9658-4d04d2721fcb
Host: devrel-ga-9116.api.identitynow-demo.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
 
HTTP/1.1 200 OK
Date: Thu, 14 Mar 2024 15:03:31 GMT
Content-Type: application/json;charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: nginx
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
X-Total-Count: 2
Cache-Control: no-cache, no-store, must-revalidate
SLPT-Request-ID: 03ffd2d1fd2a48738de45125a4e225d5
Access-Control-Expose-Headers: Retry-After,Connection,X-Total-Count,SLPT-Request-ID,Content-Length,Date,X-Zuul-ServiceId,Content-Type
X-Robots-Tag: none
X-Robots-Tag: noindex
 
[{"id":"706415cf-2c7d-4c0a-8b75-6120ec503b80","created":"2024-03-14T13:49:09.133Z","modified":"2024-03-14T13:49:09.147Z","medium":"EMAIL","key":"cloud_manual_work_item_summary","name":"Pending Task Daily Digest","description":"If enabled sent to users daily when they have incomplete tasks in their Task Manager.","locale":"en","subject":"#set($numberOfPendingTasks \u003d $__numberTool.integer($numberOfPendingTasks))#set($taskTasks \u003d \"#if($numberOfPendingTasks \u003d\u003d 1)task#{else}tasks#end\")\nYou have $numberOfPendingTasks $taskTasks to complete in ${__global.productName}.","header":null,"body":"Dear $__recipient.name,\u003cbr /\u003e\u003cbr /\u003e#set($numberOfPendingTasks \u0026#61; $__numberTool.integer($numberOfPendingTasks))\n#set($isAre \u0026#61; \u0026#34;#if( $numberOfPendingTasks \u0026#61;\u0026#61; 1)is#{else}are#end\u0026#34;)\n#set($taskTasks \u0026#61; \u0026#34;#if( $numberOfPendingTasks \u0026#61;\u0026#61; 1)task#{else}tasks#end\u0026#34;)\n#set($url \u0026#61; \u0026#34;${__global.productUrl}/ui/main#launch:tasks\u0026#34;)\n\nThere $isAre $numberOfPendingTasks $taskTasks waiting for you in your $__global.productName Task Manager.\u003cbr /\u003e Use each task\u0026#39;s details to finish it on the source, then mark it as complete in ${__global.productName}. To do this work, go to the task manager \u003ca href\u003d\"$url\"\u003ehere\u003c/a\u003e, or copy and paste this link into your browser: $url\u003cbr /\u003e\u003cbr /\u003eThanks,\u003cbr /\u003e The $__global.productName Team\u003cbr /\u003e","footer":null,"from":"$__global.emailFromAddress","replyTo":"$__global.emailFromAddress","slackTemplate":null,"teamsTemplate":null},{"id":"01a0778e-89b4-450c-9485-b6b8600e0dbf","created":"2024-03-14T13:40:58.403Z","modified":"2024-03-14T13:40:58.426Z","medium":"EMAIL","key":"non_employee_request_created","name":"Non-Employee Request Created","description":"Sent to a non-employee account manager to confirm that their request for a new account for a non-employee was submitted.","locale":"en","subject":"You’ve requested a non-employee account for ${data.firstName} ${data.lastName}","header":null,"body":"Dear $__recipient.name,\u003cbr /\u003e\u003cbr /\u003e#set($_sourceName \u0026#61; $data.nonEmployeeSource.name)\n#set($_approverIds \u0026#61; $__util.getObjectByJsonPath($__contentJson, \u0026#39;$.data.approvalItems[*].approver.id\u0026#39;))\n\n\u003cp\u003eYour request for a non-employee account for $data.accountName on the source $_sourceName was successfully submitted.\u003c/p\u003e\n#if($_approverIds.size() \u0026gt; 0)\n #if($_approverIds.size() \u0026#61;\u0026#61; 1)\n \u003cp\u003e$__util.getUser($_approverIds[0]).name must approve this account request before it can be added to the source.\u003c/p\u003e\n #elseif($_approverIds.size() \u0026gt; 1)\n \u003cp\u003eThe following reviewers must approve this account request before it can be added to the source:\u003c/p\u003e\n \u003cul\u003e\u003cli\u003e\n #foreach($_approverId in $_approverIds)\n \u003c/li\u003e\u003cli\u003e$__util.getUser($_approverId).name\u003c/li\u003e\u003cli\u003e\n #end\n \u003c/li\u003e\u003c/ul\u003e\n #end\n\u003cp\u003eYou will be notified when a decision is made about this account request. You can check the status of your request by clicking Manage Non-Employees on the dashboard and viewing the $_sourceName source.\u003c/p\u003e\n#{else}\n\u003cp\u003e\n This account will be added to $_sourceName shortly. You can check its status by clicking Manage Non-Employees on the dashboard and viewing the $_sourceName source.\n\u003c/p\u003e\n#end\n\u003cbr /\u003eThanks,\u003cbr /\u003e The $__global.productName Team\u003cbr /\u003e","footer":null,"from":"$__global.emailFromAddress","replyTo":"$__global.emailFromAddress","slackTemplate":null,"teamsTemplate":null}]
GET https://partner6037.api.identitynow-demo.com/beta/notification-templates?filters=medium%20eq%20%22EMAIL%22: {
  "Network": {
    "addresses": {
      "local": {
        "address": "192.168.1.170",
        "family": "IPv4",
        "port": 55972
      },
      "remote": {
        "address": "52.205.4.65",
        "family": "IPv4",
        "port": 443
      }
    },
    "tls": {
      "reused": false,
      "authorized": true,
      "authorizationError": null,
      "cipher": {
        "name": "ECDHE-RSA-AES128-GCM-SHA256",
        "standardName": "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
        "version": "TLSv1/SSLv3"
      },
      "protocol": "TLSv1.2",
      "ephemeralKeyInfo": {},
      "peerCertificate": {
        "subject": {
          "commonName": "*.api.identitynow-demo.com",
          "alternativeNames": "DNS:*.api.identitynow-demo.com"
        },
        "issuer": {
          "country": "US",
          "organization": "Amazon",
          "commonName": "Amazon RSA 2048 M03"
        },
        "validFrom": "Sep 16 00:00:00 2023 GMT",
        "validTo": "Oct 14 23:59:59 2024 GMT",
        "fingerprint": "A9:97:5A:44:AD:AE:ED:B5:1A:BA:20:87:79:F2:95:3B:20:69:0C:70",
        "serialNumber": "0402682d6d3a9bf3c2ffcce25817dbde"
      }
    }
  },
  "Request Headers": {
    "authorization": "Bearer ",
    "user-agent": "PostmanRuntime/7.37.0",
    "accept": "*/*",
    "postman-token": "b3575aff-9f22-4c67-8c86-8566d944adc0",
    "host": "partner6037.api.identitynow-demo.com",
    "accept-encoding": "gzip, deflate, br",
    "connection": "keep-alive"
  },
  "Response Headers": {
    "date": "Tue, 26 Mar 2024 02:56:09 GMT",
    "content-type": "application/json;charset=utf-8",
    "transfer-encoding": "chunked",
    "connection": "keep-alive",
    "server": "nginx",
    "vary": [
      "Origin",
      "Access-Control-Request-Method",
      "Access-Control-Request-Headers"
    ],
    "x-total-count": "0",
    "cache-control": "no-cache, no-store, must-revalidate",
    "slpt-request-id": "607c138ea106415d8c55aea9d0dadcaf",
    "access-control-expose-headers": "Retry-After,Connection,X-Total-Count,SLPT-Request-ID,Content-Length,Date,X-Zuul-ServiceId,Content-Type",
    "x-robots-tag": [
      "none",
      "noindex"
    ]
  },
  "Response Body": "[]"
}