<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic R80.10 API verify-policy Postman response in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/R80-10-API-verify-policy-Postman-response/m-p/12498#M893</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to pass the task-id response value from a verify-policy request in Postman as an environment variable.&amp;nbsp; However, it appears that the output of "task-id" is not a valid json reference?&amp;nbsp;&amp;nbsp;Based on my testing it appears to be because of the dash "-" in the name "task-id".&amp;nbsp; Does anyone know of another why to retrieve this value?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my request:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I perform a verify-policy POST and get the following response:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt; "task-id" : "01234567-89ab-cdef-9966-b355dd0c80f1"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That request also has&amp;nbsp;a test script to take the value of "task-id" and put it in my environment as variable "tk".&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var jsonData = JSON.parse(responseBody);&lt;/P&gt;&lt;P&gt;//use task as variable&lt;BR /&gt;postman.setEnvironmentVariable("tk", jsonData.task-id);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But executing this results in error, and the output from the Postman console indicates it is not defined, despite it shown in the response body.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;DIV class="" style="color: var(--content-primary); border-bottom: 1px solid var(--hairline-regular); font-weight: normal; font-size: 12px;"&gt;&lt;DIV class=""&gt;&lt;DIV class="" style="font-size: 12px; padding: 0px 10px 0px 0px;"&gt;ReferenceError | id is not defined&lt;/DIV&gt;&lt;DIV class="" style="font-size: 12px; padding: 0px 10px 0px 0px;"&gt; &lt;/DIV&gt;&lt;DIV class="" style="font-size: 12px; padding: 0px 10px 0px 0px;"&gt;&lt;IMG class="image-1 jive-image" src="https://community.checkpoint.com/legacyfs/online/checkpoint/76152_pastedImage_9.png" /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV class="" style="color: var(--content-primary); border-bottom: 1px solid var(--hairline-regular); font-weight: normal; font-size: 12px;"&gt;&lt;DIV class=""&gt;&lt;DIV class="" style="font-size: 12px; padding: 0px 10px 0px 0px;"&gt;Also i think the API reference&amp;nbsp;documentation is incorrect as the only response i get from a web-session API call is the task-id, i do not receive the failure messages.&amp;nbsp; The only output I receive from my verify-policy POST is a task-id (contrary to the API reference with results for failure), whether the verification is good or has errors.&amp;nbsp; Therefore I am trying to also view the results of the verification task when it completes.&amp;nbsp; I am using the task-id in a following request to view the output of the verification (i.e. show-task API request).&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="" style="font-size: 12px; padding: 0px 10px 0px 0px;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="" style="color: var(--content-primary); border-bottom: 1px solid var(--hairline-regular); font-weight: normal; font-size: 12px;"&gt;&lt;DIV class=""&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Dec 2018 15:38:47 GMT</pubDate>
    <dc:creator>Jason_Rakers</dc:creator>
    <dc:date>2018-12-03T15:38:47Z</dc:date>
    <item>
      <title>R80.10 API verify-policy Postman response</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/R80-10-API-verify-policy-Postman-response/m-p/12498#M893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to pass the task-id response value from a verify-policy request in Postman as an environment variable.&amp;nbsp; However, it appears that the output of "task-id" is not a valid json reference?&amp;nbsp;&amp;nbsp;Based on my testing it appears to be because of the dash "-" in the name "task-id".&amp;nbsp; Does anyone know of another why to retrieve this value?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my request:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I perform a verify-policy POST and get the following response:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt; "task-id" : "01234567-89ab-cdef-9966-b355dd0c80f1"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That request also has&amp;nbsp;a test script to take the value of "task-id" and put it in my environment as variable "tk".&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var jsonData = JSON.parse(responseBody);&lt;/P&gt;&lt;P&gt;//use task as variable&lt;BR /&gt;postman.setEnvironmentVariable("tk", jsonData.task-id);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But executing this results in error, and the output from the Postman console indicates it is not defined, despite it shown in the response body.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;DIV class="" style="color: var(--content-primary); border-bottom: 1px solid var(--hairline-regular); font-weight: normal; font-size: 12px;"&gt;&lt;DIV class=""&gt;&lt;DIV class="" style="font-size: 12px; padding: 0px 10px 0px 0px;"&gt;ReferenceError | id is not defined&lt;/DIV&gt;&lt;DIV class="" style="font-size: 12px; padding: 0px 10px 0px 0px;"&gt; &lt;/DIV&gt;&lt;DIV class="" style="font-size: 12px; padding: 0px 10px 0px 0px;"&gt;&lt;IMG class="image-1 jive-image" src="https://community.checkpoint.com/legacyfs/online/checkpoint/76152_pastedImage_9.png" /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV class="" style="color: var(--content-primary); border-bottom: 1px solid var(--hairline-regular); font-weight: normal; font-size: 12px;"&gt;&lt;DIV class=""&gt;&lt;DIV class="" style="font-size: 12px; padding: 0px 10px 0px 0px;"&gt;Also i think the API reference&amp;nbsp;documentation is incorrect as the only response i get from a web-session API call is the task-id, i do not receive the failure messages.&amp;nbsp; The only output I receive from my verify-policy POST is a task-id (contrary to the API reference with results for failure), whether the verification is good or has errors.&amp;nbsp; Therefore I am trying to also view the results of the verification task when it completes.&amp;nbsp; I am using the task-id in a following request to view the output of the verification (i.e. show-task API request).&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="" style="font-size: 12px; padding: 0px 10px 0px 0px;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="" style="color: var(--content-primary); border-bottom: 1px solid var(--hairline-regular); font-weight: normal; font-size: 12px;"&gt;&lt;DIV class=""&gt; &lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2018 15:38:47 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/R80-10-API-verify-policy-Postman-response/m-p/12498#M893</guid>
      <dc:creator>Jason_Rakers</dc:creator>
      <dc:date>2018-12-03T15:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: R80.10 API verify-policy Postman response</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/R80-10-API-verify-policy-Postman-response/m-p/12499#M894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In Javascript you cannot call a field from json with a hyphen in it the traditional way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to do jsonObj['task-id']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://stackoverflow.com/questions/13869627/unable-to-access-json-property-with-dash" title="https://stackoverflow.com/questions/13869627/unable-to-access-json-property-with-dash"&gt;javascript - Unable to access JSON property with "-" dash - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2018 16:38:05 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/R80-10-API-verify-policy-Postman-response/m-p/12499#M894</guid>
      <dc:creator>Joshua_Hatter</dc:creator>
      <dc:date>2018-12-03T16:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: R80.10 API verify-policy Postman response</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/R80-10-API-verify-policy-Postman-response/m-p/12500#M895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!&amp;nbsp; That works!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My updated test script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var jsonData = JSON.parse(responseBody);&lt;/P&gt;&lt;P&gt;//use task as variable&lt;BR /&gt;postman.setEnvironmentVariable("tk", jsonData['task-id']);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2018 17:26:28 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/R80-10-API-verify-policy-Postman-response/m-p/12500#M895</guid>
      <dc:creator>Jason_Rakers</dc:creator>
      <dc:date>2018-12-03T17:26:28Z</dc:date>
    </item>
  </channel>
</rss>

