<?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 Re: API Error codes in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144353#M6645</link>
    <description>&lt;P&gt;Dor,&lt;BR /&gt;You don't have to parse the &lt;EM&gt;message&lt;/EM&gt; key to know what is wrong. The &lt;EM&gt;.data.code&lt;/EM&gt; tells you the error code. Out of that error code, you might have different messages, which in your case produces two (2) messages. 1) Errors array ["More than one object named 'FTP' exists."] (.data.errors[].message), and 2) Warnings array ["The port is already used by another service."] (.data.warnings[].message).&lt;/P&gt;
&lt;P&gt;Now you need to know and understand Check Point product to understand the validation aspect here, but you can choose to ignore &lt;EM&gt;warning&lt;/EM&gt;s and/or &lt;EM&gt;errors&lt;/EM&gt; if that is what you want/need. Another aspect is settings an object which already exists. You will need to use the parameter &lt;EM&gt;set-if-exists&lt;/EM&gt;, or else you will get an error as well. My point here, is you need to know what you are trying to accomplish.&lt;/P&gt;
&lt;P&gt;Additionally, in documentation, we do give for each API call our Error codes. Feel free to use those as your Enum.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/#cli/add-service-tcp~v1.8%20" target="_blank"&gt;https://sc1.checkpoint.com/documents/latest/APIs/#cli/add-service-tcp~v1.8%20&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Please let us know if you have any questions or concerns.&lt;/P&gt;
&lt;P&gt;Good luck!&lt;/P&gt;</description>
    <pubDate>Mon, 21 Mar 2022 19:57:52 GMT</pubDate>
    <dc:creator>Art_Zalenekas</dc:creator>
    <dc:date>2022-03-21T19:57:52Z</dc:date>
    <item>
      <title>API Error codes</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144289#M6639</link>
      <description>&lt;P&gt;hey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am just starting to work with the API, something really frustrating with the return messages with errors.&lt;/P&gt;&lt;P&gt;below is what i get when trying to create an object, what i was excepted as a programmer that each individual error type will have a different error code that i can compare, and not to "parse" the error message to understand what is the type of error message to handle.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do you think different ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;do you get different responses?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;APIResponse({&lt;BR /&gt;"data": {&lt;BR /&gt;"code": "err_validation_failed",&lt;BR /&gt;"errors": [&lt;BR /&gt;{&lt;BR /&gt;"message": "More than one object named 'FTP' exists."&lt;BR /&gt;}&lt;BR /&gt;],&lt;BR /&gt;"message": "Validation failed with 1 warning and 1 error",&lt;BR /&gt;"warnings": [&lt;BR /&gt;{&lt;BR /&gt;"message": "The port is already used by another service."&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;},&lt;BR /&gt;"error_message": "code: err_validation_failed\nmessage: Validation failed with 1 warning and 1 error\nwarnings: \n- message: The port is already used by another service.\nerrors: \n- message: More than one object named 'FTP' exists.\n",&lt;BR /&gt;"res_obj": {&lt;BR /&gt;"data": {&lt;BR /&gt;"code": "err_validation_failed",&lt;BR /&gt;"errors": [&lt;BR /&gt;{&lt;BR /&gt;"message": "More than one object named 'FTP' exists."&lt;BR /&gt;}&lt;BR /&gt;],&lt;BR /&gt;"message": "Validation failed with 1 warning and 1 error",&lt;BR /&gt;"warnings": [&lt;BR /&gt;{&lt;BR /&gt;"message": "The port is already used by another service."&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;},&lt;BR /&gt;"status_code": 400&lt;BR /&gt;},&lt;BR /&gt;"status_code": 400,&lt;BR /&gt;"success": false&lt;BR /&gt;})&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 12:21:16 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144289#M6639</guid>
      <dc:creator>Dor_Marcovitch</dc:creator>
      <dc:date>2022-03-21T12:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: API Error codes</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144349#M6643</link>
      <description>&lt;P&gt;Ultimately, the API is returning the expected result in this case.&lt;BR /&gt;There are two issues, ultimately (one warning, one error).&lt;BR /&gt;Whether that result is optimal or not is a different question.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 19:18:20 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144349#M6643</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2022-03-21T19:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: API Error codes</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144353#M6645</link>
      <description>&lt;P&gt;Dor,&lt;BR /&gt;You don't have to parse the &lt;EM&gt;message&lt;/EM&gt; key to know what is wrong. The &lt;EM&gt;.data.code&lt;/EM&gt; tells you the error code. Out of that error code, you might have different messages, which in your case produces two (2) messages. 1) Errors array ["More than one object named 'FTP' exists."] (.data.errors[].message), and 2) Warnings array ["The port is already used by another service."] (.data.warnings[].message).&lt;/P&gt;
&lt;P&gt;Now you need to know and understand Check Point product to understand the validation aspect here, but you can choose to ignore &lt;EM&gt;warning&lt;/EM&gt;s and/or &lt;EM&gt;errors&lt;/EM&gt; if that is what you want/need. Another aspect is settings an object which already exists. You will need to use the parameter &lt;EM&gt;set-if-exists&lt;/EM&gt;, or else you will get an error as well. My point here, is you need to know what you are trying to accomplish.&lt;/P&gt;
&lt;P&gt;Additionally, in documentation, we do give for each API call our Error codes. Feel free to use those as your Enum.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/#cli/add-service-tcp~v1.8%20" target="_blank"&gt;https://sc1.checkpoint.com/documents/latest/APIs/#cli/add-service-tcp~v1.8%20&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Please let us know if you have any questions or concerns.&lt;/P&gt;
&lt;P&gt;Good luck!&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2022 19:57:52 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144353#M6645</guid>
      <dc:creator>Art_Zalenekas</dc:creator>
      <dc:date>2022-03-21T19:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: API Error codes</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144372#M6646</link>
      <description>&lt;P&gt;What i mean is that the .data.code value of err_validation_failed is too general to know that the validation error is duplicate name exist. Unless you tell me that this error means that is the case but basic logic tells me this is some general validation error and many others can be.&amp;nbsp;&lt;/P&gt;&lt;P&gt;To solve the case programmatically i will need to parse woth regex the message to see the validation error is about duplicate name. And try to create an object with another name.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2022 05:00:45 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144372#M6646</guid>
      <dc:creator>Dor_Marcovitch</dc:creator>
      <dc:date>2022-03-22T05:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: API Error codes</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144410#M6649</link>
      <description>&lt;P&gt;another example when trying to add "8731_tcp" object:&lt;/P&gt;&lt;P&gt;error_code: code: err_validation_failed&lt;BR /&gt;message: Validation failed with 1 blocking-error&lt;BR /&gt;blocking-errors:&lt;BR /&gt;- message: Object name must start with a letter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2022 12:25:54 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144410#M6649</guid>
      <dc:creator>Dor_Marcovitch</dc:creator>
      <dc:date>2022-03-22T12:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: API Error codes</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144412#M6650</link>
      <description>&lt;P&gt;How about you call it (supposedly service object) tcp_8731?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2022 12:33:39 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144412#M6650</guid>
      <dc:creator>_Val_</dc:creator>
      <dc:date>2022-03-22T12:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: API Error codes</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144417#M6651</link>
      <description>&lt;P&gt;this i what i do, basically i am migrating configuration, and need to "act" based on the validation error.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2022 13:09:41 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144417#M6651</guid>
      <dc:creator>Dor_Marcovitch</dc:creator>
      <dc:date>2022-03-22T13:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: API Error codes</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144442#M6652</link>
      <description>&lt;P&gt;It would be nice to have more granular errors, absolutely.&lt;/P&gt;
&lt;P&gt;In the case of config migration, you can skip a lot of headache using 'show objects filter &amp;lt;expression&amp;gt;'. You can use it to check for the actual values as well as the names. If there's no object for the semantic value you're trying to build, check for your proposed name. If there's no object for your proposed name, create it. If there's an object using your proposed name, go to an alternate name (like adding an _# to the end of the name and incrementing the # as needed). Of course, including a migration identifier (like a project number or ticket number) in the proposed name all but guarantees you won't have name collisions.&lt;/P&gt;
&lt;P&gt;All the 'show objects' API calls cost time, sure, but they help preemptively ensure correctness.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2022 15:30:04 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-Error-codes/m-p/144442#M6652</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2022-03-22T15:30:04Z</dc:date>
    </item>
  </channel>
</rss>

