• I purchased the Pro version
    But I have problem in creating tasks via REST API Request (via Postman)
    Asin API documentation:

    {
    “name”: “The task name or title”,
    “description”: “The task description”,
    “project”: “Project ID. Leave empty for no project.”,
    “assignee”: “Assignee ID. Leave empty for no assignee”,
    “start”: “Start date as date string. Any format should work.”,
    “end”: “End date as date string. Any format should work.”,
    “custom_fields”: “Only for the pro version. Send custom fields as JSON.”,
    }

    Could you give me some example of JSON in Custom Field above?
    Example: I need to add:
    field id = 1
    field lable = email
    field value = [email protected]
    ;
    field id = 2
    field lable = phone
    field value = 01234566789

    (Im using Postman)
    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter alphantv

    (@alphantv)

    iT’S NOT WORK:

    {
    "name": "The task name or title",
    "description": "The task description",
    "project": "4",
    "assignee": "64",
    "start": "",
    "end": "",
    "custom_fields": "{
    "id": 1,
    "value": "[email protected]"
    },
    {
    "id": 2,
    "value": "01234566789"
    }"
    }

    The Error is:

    {
        "code": "rest_invalid_json",
        "message": "Body JSON kh?ng h?p l?.",
        "data": {
            "status": 400,
            "json_error_code": 3,
            "json_error_message": "Control character error, possibly incorrectly encoded"
        }
    }
    Plugin Author Dylan James

    (@dylanjkotze)

    Thanks for the response.

    Can I kindly ask you to please try it like this instead:

    {
    “name”: “The task name or title”,
    “description”: “The task description”,
    “project”: “4”,
    “assignee”: “64”,
    “start”: “”,
    “end”: “”,
    “custom_fields”: [
    {
    “id”: 1,
    “value”: “[email protected]
    },
    {
    “id”: 2,
    “value”: “01234566789”
    }
    ]
    }

    Please let me know if that works as expected.

    Thanks.

    Kindest regards,
    Dylan

    Thread Starter alphantv

    (@alphantv)

    Then It got Syntax error with that code:

    {
        "code": "rest_invalid_param",
        "message": "Invalid parameter(s): custom_fields",
        "data": {
            "status": 400,
            "params": {
                "custom_fields": "Invalid parameter."
            }
        }
    }
    • This reply was modified 4 years, 2 months ago by alphantv.
    • This reply was modified 4 years, 2 months ago by alphantv.
    Plugin Author Dylan James

    (@dylanjkotze)

    Hi,

    It seems like there was an issue with the encoding of the double quotation marks causing the syntax issues.

    Could I please ask you to try the updated code below and let me know if this works correctly and make sure the quotation marks are not incorrectly formatted when copied

    {
      "name": "The task name or title",
      "description": "The task description",
      "project": "4",
      "assignee": "64",
      "start": "",
      "end": "",
      "custom_fields": [
        {
          "id": 1,
          "value": "[email protected]"
        },
        {
          "id": 2,
          "value": "01234566789"
        }
      ]
    }

    Thanks and sorry for the inconvenience.

    Best regards,
    Dylan

    Thread Starter alphantv

    (@alphantv)

    I copied exactly the code above, but got the “Invalid parameter” error. Seem It had some errors in decoding the json in API source code.

    {
        "code": "rest_invalid_param",
        "message": "Invalid parameter(s): custom_fields",
        "data": {
            "status": 400,
            "params": {
                "custom_fields": "Invalid parameter."
            }
        }
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Field – Rest API’ is closed to new replies.