MOR API tariff retail import
From Kolmisoft Wiki
Jump to navigationJump to search
This functionality is available from MOR 11
MOR API
Import XML Retail tariff
- Call: /api/import_tariff_retail
- Methods: POST
- Params:
- u - username to login. Required.
- p - password to login. Required.
- xml - retail tariff in xml format. Required.
- Returns response in xml:
- Success:
<response> <tariff_id> ID </tariff_id> <tariff_name> TARIFF NAME </tariff_name> <bad_destinations></bad_destinations> <destination_with_bad_rates></destination_with_bad_rates> <destination_with_time_collisions_in_xml></destination_with_time_collisions_in_xml> <destination_with_time_collisions_in_db></destination_with_time_collisions_in_db> </response>
- Errors:
- if bad xml format:
<response> <error> File does not exist </error> </response>
or
<response> <error> Bad XML data </error> </response>
- if tariff name does not match with existing tariff found by ID
<response> <error> TARIFF NAME WITH THIS ID DO NOT MATCH !!!FOUND tariff_name </error> </response>
- if tariff was not found by ID, but tariff with same name exists
<response> <error> TARIFF with same name exists, ID:tariff_id!!! CHANGE NAME OR ID </error> </response>
- if no destinations found in xml:
<response> <error> No destinations! </error> <tariff_id> ID </tariff_id> <tariff_name> TARIFF NAME </tariff_name> </response>
- if no destination found by destination name or bad destination name
<response> <tariff_id> ID </tariff_id> <tariff_name> TARIFF NAME </tariff_name> <bad_destinations> <destination_group_name> DESTINATION GROUP NAME </destination_group_name> <destination_group_type> DESTINATION GROUP TYPE </destination_group_type> </bad_destinations> <destination_with_bad_rates></destination_with_bad_rates> <destination_with_time_collisions_in_xml></destination_with_time_collisions_in_xml> <destination_with_time_collisions_in_db></destination_with_time_collisions_in_db> </response>
- if bad rate in destination
<response> <tariff_id> ID </tariff_id> <tariff_name> TARIFF NAME </tariff_name> <bad_destinations></bad_destinations> <destination_with_bad_rates> <destination_group_name> DESTINATION GROUP NAME </destination_group_name> <destination_group_type> DESTINATION GROUP TYPE </destination_group_type> <rate_price> 1 </rate_price> <rate_round_by> 588888 </rate_round_by> <rate_duration> 7 </rate_duration> <rate_type> minute </rate_type> <rate_start_time> 00:00:00 </rate_start_time> <rate_end_time> 23:99:99 </rate_end_time> <day_type/> </destination_with_bad_rates> </response>
- if time collision in xml destination rates
<response> <tariff_id> ID </tariff_id> <tariff_name> TARIFF NAME </tariff_name> <bad_destinations></bad_destinations> <destination_with_bad_rates></destination_with_bad_rates> <destination_with_time_collisions_in_xml> <collision_in_time_range> Destination group name Destination group type COLLISION IN rate start AND rate end TIME RANGE </collision_in_time_range> </destination_with_time_collisions_in_xml> <destination_with_time_collisions_in_db></destination_with_time_collisions_in_db> </response>
- if time collision between xml rates and existing rates
<response> <tariff_id> ID </tariff_id> <tariff_name> TARIFF NAME </tariff_name> <bad_destinations></bad_destinations> <destination_with_bad_rates></destination_with_bad_rates> <destination_with_time_collisions_in_xml></destination_with_time_collisions_in_xml> <destination_with_time_collisions_in_db> <collision_in_time_range> Destination group name Destination group type COLLISION WITH EXISTING RATES IN rate start AND rate end TIME RANGE </collision_in_time_range> </destination_with_time_collisions_in_db>
</response>