How to add attachements while creating a ticket in freshdesk in react native

96 Views Asked by At
 {
    "name": "afshana",
    "email": "[email protected]",
    "subject": "Defective",
    "description": "defective",
    "custom_fields": {
        "cf_function874737": "POS",
        "cf_type": "POS",
        "cf_sub_type434709": "Category Mismatch"
    },
     "attachments":[
     {
        "content_type":"image/jpeg",  
        "name":"Sunflower_from_Silesia2.ext",
        "uri":"https://upload.wikimedia.org/wikipedia/commons/4/41/Sunflower_from_Silesia2.jpg"
     }
  ]
}

This the JSON format I'm trying to send it in the API https://capsteam.freshdesk.com/api/v2/tickets for creating a ticket in react native but every time its showing:

{
    "description": "Validation failed",
    "errors": [
        {
            "field": "attachments",
            "message": "It should contain elements of type valid file format only",
            "code": "datatype_mismatch"
        }
    ]
}

This showing in the postman.
So can I get the correct way how to do this?

{
    "name": "afshana",
    "email": "[email protected]",
    "subject": "Defective",
    "description": "defective",
    "custom_fields": {
        "cf_function874737": "POS",
        "cf_type": "POS",
        "cf_sub_type434709": "Category Mismatch"
    },
     "attachments":[
     {
        "content_type":"image/jpeg",  
        "name":"Sunflower_from_Silesia2.ext",
        "uri":"https://upload.wikimedia.org/wikipedia/commons/4/41/Sunflower_from_Silesia2.jpg"
     }
  ]
}

I tried with this and got:

{
    "description": "Validation failed",
    "errors": [
        {
            "field": "attachments",
            "message": "It should contain elements of type valid file format only",
            "code": "datatype_mismatch"
        }
    ]
}
0

There are 0 best solutions below