EN
Español
English
Português
    Adding Values in Additional Tree-Type Fields

    Petition Details

    • URL Base: {host}/ASMSAPI/
    • URI: /api/v9/additionalsfields/{fieldId}/values
    • Guy:POST
    • Required Headers:

    • content-type: application/json
    • X-Authorization: Bearer {token}

    URL Description

    • {host}: It represents the domain of the environment in which the API is located.
    • ASMSAPI/: Fixed API prefix.
    • {fieldId}: ID of the additional tree-type field where the value will be added.
    • URI: Specific endpoint for the request.


    EXAMPLE URL:

    https://{host}/ASMSAPI/api/v9/additionalsfields/1787/values
    


    Previous step: Obtain available parent values

    Before you add a child value, check the available parent values to associate the new value with it:

    Query endpoint:

    GET /ASMSAPI/api/v9/additionalsfields/{fieldId}/type/7/values?dataType=0
    

    Query parameters:

    Name Data type Description
    fieldId Number Tree-type additional field ID
    type Number Field Type (7 for Tree)
    Datatype Number Data Type (0 default)

    Sample answer:

    [
        {
            "catalogId": 0,
            "description": null,
            "fieldId": 1787,
            "hasChild": false,
            "id": 2950,
            "key": null,
            "name": "API",
            "order": 0,
            "parentId": null,
            "restrictLevel": false,
            "status": 0
        }
    ]
    

    Note: >

    • The countryside id in the answer is the one that should be used as ParentId when adding a new value.


    Petition Parameters

    Name Data type Obligatory Description
    Value Text Yes Name of the value to be added
    ParentId Number No ID of the parent value (obtained from the previous query endpoint)

    Body of the petition

    {
      "Value": "Colombia",
      "ParentId": 2950
    }
    

    Note: >

    • If you don’t include ParentId, the value will be added as a root value without a parent.


    Answer

    Success (Status 200)

    {
        "result": true
    }
    

    Response Parameters

    Name Data type Description
    result Boolean Indicates whether the operation was successful


    Error Messages

    Code HTTP status Error Message
    401 Unauthorized You do not have permission to view this directory or page
    400 Bad Request FailureAddValueToField