Methods


Entity Properties


import_config.search (null|object $filters, array $options = [])

Retrieve list of configurations. Filtration could be applied.

Parameters

i
orderdescription
0
  • null - Retrieve list of all configurations.
  • object - Retrieve list of configurations using specified filters.
1
  • null - No options will be applied.
  • object - Apply specified options.

Return Value

An array of objects. Each object will contain “Import Config Properties”.

Example Request

Get import config for one config id:

{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "method" : "call",
    "params" : [
        "be1c13ed4e03f0ed7f1e4053dfff9658",
        "import_config.search",
        [
            {
                "config_id" : {
                    "eq" : 1
                }
            },
            []
        ]
    ]
}

Example Response

{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "error" : null,
    "result" : [
        {
            "config_id" : 1,
            "name" : "Microsoft GP Dynamics",
            "entity_type" : "order",
            "file_type" : "excel"
        }
    ]
}

Error Codes

code message
101 Invalid filters given. Details in error message.

import.search (null|object $filters, array $options = [])

Retrieve list of imports. Filtration could be applied.

Parameters

orderdescription
0
  • null - Retrieve list of all imports.
  • object - Retrieve list of imports using specified filters.
1
  • null - No options will be applied.
  • object - Apply specified options.

Return Value

An array of objects. Each object will contain “Import Properties”.

Example Request

Get import details for one import id:

{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "method" : "call",
    "params" : [
        "be1c13ed4e03f0ed7f1e4053dfff9658",
        "import_config.search",
        [
            {
                "task_id" : {
                    "eq" : 1
                }
            },
            []
        ]
    ]
}

Example Response

{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "error" : null,
    "result" : [
        {
            "task_id" : 1,
            "config_id" : 1,
            "status" : "complete",
            "progress" : 100,
            "num_records" : 6,
            "num_parse_success" : 6,
            "num_parse_failures" : 0,
            "num_submit_success" : 1,
            "num_submit_failures" : 5
        }
    ]
}

Error Codes

code message
101 Invalid filters given. Details in error message.

import.info (string $taskId, null|object $fields = [])

Retrieve full order information.

Parameters

orderdescription
0 string - Import unique ID.
1
  • null - Retrieve basic import properties.
  • array - Defined list of properties to retrieve. "records" will add records information which is excluded by default.

Return Value

Object which contains the specified (or default if no fields parameter was given) “Import Properties”.

Example Request

Get order information for the specified order:

{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "method" : "call",
    "params" : [
        "be1c13ed4e03f0ed7f1e4053dfff9658",
        "import.info",
        [
            3,
            [
                "records"
            ]
        ]
    ]
}

Example Response

{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "error" : null,
    "result" : {
        "task_id" : 1,
        "config_id" : 1,
        "status" : "complete",
        "progress" : 100,
        "num_records" : 6,
        "num_parse_success" : 6,
        "num_parse_failures" : 0,
        "num_submit_success" : 1,
        "num_submit_failures" : 5,
        "records" : [
            {
                "entity_id" : "10000045",
                "parse_status" : "valid",
                "submit_status" : "complete"
            }
        ]
    }
}

Error Codes

code message
100 Requested import does not exist.

import.create (string $data, string $configId, string $fileType, null|object $options)

Import data.

Parameters

orderdescription
0 string - base64 encoded string.
1 string - The internal import ID.
2 string - File type. Allowed: "excel", "plain_text".
3 object - Apply specified options.

Return Value

The internal import id.

Example Request

{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "method" : "call",
    "params" : [
        "be1c13ed4e03f0ed7f1e4053dfff9658",
        "import.create",
        [
            "base64 encoded data",
            2,
            "excel"
            {
                "handle_duplicates" : "drop",
                "send_email_on_complete" : 1,
                "email" : "email@example.com",
                "new_order_status" : "hold"
            }
        ]
    ]
}

Example Response

{
    "jsonrpc" : 2.0,
    "id" : 1234,
    "error" : null,
    "result" : 7
}

Error Codes

code message
101 Invalid filters given. Details in error message.
102 Config does not exist.
103 Invalid file type given.
104 Invalid file data given.
105 Internal error occurred.
106 Internal error occurred while converting the import file to CSV format.
107 Internal error occurred while scheduling import job.

Import Config Properties

config_id
{ "config_id" : 3 }
The internal configuration ID.
name
{ "name" : "Microsoft GP Dynamics" }
Configuration name.
entity_type
{ "entity_type" : "order" }
Entity type. Allowed: "order", "product", "delivery".
file_type
{ "file_type" : "excel" }
Type of the data file. Allowed: "excel", "plain_text".

Import Options Properties

handle_duplicates
{ "handle_duplicates" : "create" }
Handle duplicates. Allowed: "create", "drop", "break".
send_email_on_complete
{ "send_email_on_complete" : 1 }
Flag whether send email on task complete.
email
{ "email" : "email@example.com" }
Email address to send email after task complete. The email will only be sent if "send_email_on_complete" flag is set to 1.
file_type
{ "new_order_status" : "hold" }
Order status. Allowed: "hold".

Import Properties

task_id
{ "task_id" : 3 }
The internal import ID.
config_id
{ "config_id" : 2 }
The internal configuration ID.
status
{ "status" : "pending" }
Status. Allowed: "pending", "running", "complete".
progress
{ "progress" : 100 }
Progress percent.
num_records
{ "num_records" : 6 }
Total number of records.
num_parse_success
{ "num_parse_success" : 6 }
Number of successfully parsed records.
num_parse_failures
{ "num_parse_success" : 0 }
Number of parse failures.
num_submit_success
{ "num_submit_success" : 1 }
Number of successfully submitted records.
num_submit_failures
{ "num_submit_failures" : 5 }
Number of submit failures.