[ZBX-10607] Problems importing JSON templates Created: 2016 Apr 01  Updated: 2019 Apr 12  Resolved: 2016 May 10

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A), Frontend (F), Templates (T)
Affects Version/s: 3.0.1
Fix Version/s: 3.0.3rc1, 3.2.0alpha1

Type: Incident report Priority: Minor
Reporter: Rafael Martinez Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: api, import, json
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Centos7, PostgreSQL-9.5.1, zabbix-3.0.1


Attachments: Text File json_data_send_to_api.txt     File zabbix_export_template.json    
Issue Links:
Causes
causes ZBX-15985 json_last_error_msg() is not supporte... Open
Duplicate
is duplicated by ZBXNEXT-3225 Problems importing JSON templates Closed

 Description   

Zabbix has problems importing templates in JSON format. XML works without problems.

If one use the zabbix API to export a template in JSON format (check attachment:zabbix_export_template.json) , the system will not be able to import this export file via the API or the frontend.

The error we get via de API is: "... Application error.: Invalid XML tag "/zabbix_export/groups": unexpected tag "0". while sending ...."

Via the frontend the error is: "...Invalid XML tag "/zabbix_export/groups": unexpected tag "0"...."

According to the documentation this should work, "Import supports both XML and JSON, the import file must have a correct file extension: .xml for XML and .json for JSON.".

I addition, when trying to import via the API, we use "format":"json" to specify that the file is a json file. (Check attachment with full information about json data send to the API: json_data_send_to_api.txt)

It looks like the system doesn't discover that we are sending JSON data, try to parse de content as XML and fails.

Any ideas on how to fix this? Thanks.



 Comments   
Comment by vitalijs.cemeris (Inactive) [ 2016 May 05 ]

(1) Argument type error while importing incorrect json source. RESOLVED in r59895

sasha CLOSED

Comment by vitalijs.cemeris (Inactive) [ 2016 May 05 ]

(2) Translation strings changes

Strings added:

  • Cannot read JSON: %1$s.
  • Invalid tag "%1$s": %2$s.

Strings deleted:

  • Invalid XML tag "%1$s": %2$s.

sasha Updated translation strings. RESOLVED
vitalijs.cemeris CLOSED

Comment by vitalijs.cemeris (Inactive) [ 2016 May 05 ]

RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBX-10607

Comment by Alexander Vladishev [ 2016 May 06 ]

(3) Have a look at my changes in r59911.
vitalijs.cemeris CLOSED

Comment by vitalijs.cemeris (Inactive) [ 2016 May 06 ]

Fixed in:

  • pre-3.0.3rc1 59918
  • pre-3.1.0 59945
Comment by vitalijs.cemeris (Inactive) [ 2016 May 09 ]

(4) API documentation:

sasha CLOSED

Comment by Alexander Vladishev [ 2016 May 09 ]

(5) trunk/frontends/php/include/classes/import/validators/C32XmlValidator.php:906 - translation string must be changed

Invalid XML tag "%1$s": %2$s. => Invalid tag "%1$s": %2$s.

vitalijs.cemeris RESOLVED in r59977

sasha TESTED

sasha Fixed in pre-3.1.0 (trunk) r59989

CLOSED

Generated at Fri Apr 19 18:35:43 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.