Attachments with cases

Hi,

Can somebody please help to create a case with attachments using Sugar API?

I want to create a case having an attachment and then i want to retrieve it back on some case detail page.

I am creating cases using Curl.

Thank you

Parents
  • Hi  , 

    If you have access to Sugar the best would be to create a case with attachments and review the endpoints triggered by the Graphic User Interface.

    The endpoint to use would be the regular POST endpoint for the Cases module: 

    yourURL/.../Cases

    The payload should look something like this: 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    {
    "deleted": false,
    "pending_processing": false,
    "portal_viewable": true,
    "is_escalated": false,
    "perform_sugar_action": false,
    "assigned_user_id": "38dec278-f49d-4e63-9cb9-7deb78a8a3bc",
    "priority": "P1",
    "type": "Administration",
    "source": "",
    "status": "New",
    "attachments": {
    "create": [
    {
    "_link": "attachments",
    "name": "running_shoes .jpg",
    "filename_guid": "18d0ea5c-3496-11ef-864c-02a5a97c2d5e",
    "filename": "running_shoes .jpg",
    "file_mime_type": "image/jpeg",
    "file_size": 21616,
    "file_ext": "jpg",
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    Can you let me know if this leads you on the correct direction? 
    Cheers, 

    André 

  • Thank you   for you reply

    but I don't have the same response as you posted. I have this one

    {
    "id": "a7c0df4a-3466-11ef-",
    "name": "",
    "date_entered": "2024-06-27T02:21:37-07:00",
    "date_modified": "<td>2024-06-27T05:57:54-07:00</td>",
    "modified_user_id": "0eee35f4-ffaf-",
    "modified_by_name": "Awais",
    "modified_user_link": {
    "full_name": "Atha",
    "id": "0eee35f4-ffaf-11e6-87d4-",
    "_acl": {
    "fields": {
    "user_name": {
    "write": "no",
    "create": "no"
    },
    "user_hash": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "system_generated_password": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "pwd_last_changed": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "authenticate_id": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "sugar_login": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "is_admin": {
    "write": "no",
    "create": "no"
    },
    "external_auth_only": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "last_login": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "title": {
    "write": "no",
    "create": "no"
    },
    "department": {
    "write": "no",
    "create": "no"
    },
    "status": {
    "write": "no",
    "create": "no"
    },
    "license_type": {
    "write": "no",
    "create": "no"
    },
    "portal_only": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "show_on_employees": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "employee_status": {
    "write": "no",
    "create": "no"
    },
    "reports_to_id": {
    "write": "no",
    "create": "no"
    },
    "reports_to_name": {
    "write": "no",
    "create": "no"
    },
    "reports_to_link": {
    "write": "no",
    "create": "no"
    },
    "is_group": {
    "read": "no",
    "write": "no",
    "create": "no"
    }
    },
    "admin": "no",
    "developer": "no",
    "edit": "no",
    "delete": "no",
    "import": "no",
    "massupdate": "no",
    "create": "no",
    "_hash": ""
    }
    },
    "created_by": "0eee35f4-ffaf-11e6-87d4-",
    "created_by_name": "Athar Uddin",
    "created_by_link": {
    "full_name": "Athar Uddin",
    "id": "0eee35f4-ffaf-11e6-87d4-",
    "_acl": {
    "fields": {
    "user_name": {
    "write": "no",
    "create": "no"
    },
    "user_hash": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "system_generated_password": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "pwd_last_changed": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "authenticate_id": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "sugar_login": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "is_admin": {
    "write": "no",
    "create": "no"
    },
    "external_auth_only": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "last_login": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "title": {
    "write": "no",
    "create": "no"
    },
    "department": {
    "write": "no",
    "create": "no"
    },
    "status": {
    "write": "no",
    "create": "no"
    },
    "license_type": {
    "write": "no",
    "create": "no"
    },
    "portal_only": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "show_on_employees": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "employee_status": {
    "write": "no",
    "create": "no"
    },
    "reports_to_id": {
    "write": "no",
    "create": "no"
    },
    "reports_to_name": {
    "write": "no",
    "create": "no"
    },
    "reports_to_link": {
    "write": "no",
    "create": "no"
    },
    "is_group": {
    "read": "no",
    "write": "no",
    "create": "no"
    }
    },
    "admin": "no",
    "developer": "no",
    "edit": "no",
    "delete": "no",
    "import": "no",
    "massupdate": "no",
    "create": "no",
    "_hash": "9f4d3aa34f6c64d92457d5ffce1153d6"
    }
    },
    "description": "test",
    "deleted": false,
    "case_number": "<td>35396</td>",
    "type": "",
    "status": "<td>New</td>",
    "priority": "",
    "resolution": "",
    "work_log": "",
    "follow_up_datetime": "",
    "widget_follow_up_datetime": "",
    "resolved_datetime": "",
    "hours_to_resolution": 0.73,
    "business_hours_to_resolution": 0.73,
    "pending_processing": false,
    "account_name": "stonefly1",
    "accounts": {
    "name": "stonefly1",
    "id": "91fde5ce-345f-11ef-9efe-06be4ff698d4",
    "_acl": {
    "fields": {
    "dri_workflow_template_id": {
    "create": "no",
    "write": "no",
    "license": "no"
    },
    "dri_workflow_template_name": {
    "create": "no",
    "write": "no",
    "license": "no"
    }
    },
    "admin": "no",
    "developer": "no",
    "delete": "no",
    "import": "no",
    "export": "no",
    "massupdate": "no",
    "_hash": "fa530dfc673e1dd32ef98352a453e8df"
    },
    "service_level": ""
    },
    "account_id": "91fde5ce-345f-11ef-",
    "service_level": "",
    "business_center_name": "",
    "business_centers": {
    "name": "",
    "id": "",
    "_acl": {
    "fields": {
    "id": {
    "write": "no",
    "create": "no"
    },
    "name": {
    "write": "no",
    "create": "no"
    },
    "date_entered": {
    "write": "no",
    "create": "no"
    },
    "date_modified": {
    "write": "no",
    "create": "no"
    },
    "modified_user_id": {
    "write": "no",
    "create": "no"
    },
    "modified_by_name": {
    "write": "no",
    "create": "no"
    },
    "created_by": {
    "write": "no",
    "create": "no"
    },
    "created_by_name": {
    "write": "no",
    "create": "no"
    },
    "description": {
    "write": "no",
    "create": "no"
    },
    "deleted": {
    "write": "no",
    "create": "no"
    },
    "created_by_link": {
    "write": "no",
    "create": "no"
    },
    "modified_user_link": {
    "write": "no",
    "create": "no"
    },
    "activities": {
    "write": "no",
    "create": "no"
    },
    "timezone": {
    "write": "no",
    "create": "no"
    },
    "address_street": {
    "write": "no",
    "create": "no"
    },
    "address_city": {
    "write": "no",
    "create": "no"
    },
    "address_state": {
    "write": "no",
    "create": "no"
    },
    "address_postalcode": {
    "write": "no",
    "create": "no"
    },
    "address_country": {
    "write": "no",
    "create": "no"
    },
    "business_holidays": {
    "write": "no",
    "create": "no"
    },
    "business_center_accounts": {
    "write": "no",
    "create": "no"
    },
    "business_center_cases": {
    "write": "no",
    "create": "no"
    },
    "business_center_contacts": {
    "write": "no",
    "create": "no"
    },
    "business_center_leads": {
    "write": "no",
    "create": "no"
    },
    "business_center_users": {
    "write": "no",
    "create": "no"
    },
    "geocode_status": {
    "write": "no",
    "create": "no"
    },
    "following": {
    "write": "no",
    "create": "no"
    },
    "following_link": {
    "write": "no",
    "create": "no"
    },
    "my_favorite": {
    "write": "no",
    "create": "no"
    },
    "favorite_link": {
    "write": "no",
    "create": "no"
    },
    "tag": {
    "write": "no",
    "create": "no"
    },
    "tag_link": {
    "write": "no",
    "create": "no"
    },
    "commentlog": {
    "write": "no",
    "create": "no"
    },
    "commentlog_link": {
    "write": "no",
    "create": "no"
    },
    "locked_fields": {
    "write": "no",
    "create": "no"
    },
    "locked_fields_link": {
    "write": "no",
    "create": "no"
    },
    "sync_key": {
    "write": "no",
    "create": "no"
    },
    "assigned_user_id": {
    "write": "no",
    "create": "no"
    },
    "assigned_user_name": {
    "write": "no",
    "create": "no"
    },
    "assigned_user_link": {
    "write": "no",
    "create": "no"
    },
    "team_id": {
    "write": "no",
    "create": "no"
    },
    "team_set_id": {
    "write": "no",
    "create": "no"
    },
    "acl_team_set_id": {
    "write": "no",
    "create": "no"
    },
    "team_count": {
    "write": "no",
    "create": "no"
    },
    "team_name": {
    "write": "no",
    "create": "no"
    },
    "acl_team_names": {
    "write": "no",
    "create": "no"
    },
    "team_link": {
    "write": "no",
    "create": "no"
    },
    "team_count_link": {
    "write": "no",
    "create": "no"
    },
    "teams": {
    "write": "no",
    "create": "no"
    },
    "is_open_sunday": {
    "write": "no",
    "create": "no"
    },
    "sunday_open_hour": {
    "write": "no",
    "create": "no"
    },
    "sunday_open_minutes": {
    "write": "no",
    "create": "no"
    },
    "sunday_close_hour": {
    "write": "no",
    "create": "no"
    },
    "sunday_close_minutes": {
    "write": "no",
    "create": "no"
    },
    "is_open_monday": {
    "write": "no",
    "create": "no"
    },
    "monday_open_hour": {
    "write": "no",
    "create": "no"
    },
    "monday_open_minutes": {
    "write": "no",
    "create": "no"
    },
    "monday_close_hour": {
    "write": "no",
    "create": "no"
    },
    "monday_close_minutes": {
    "write": "no",
    "create": "no"
    },
    "is_open_tuesday": {
    "write": "no",
    "create": "no"
    },
    "tuesday_open_hour": {
    "write": "no",
    "create": "no"
    },
    "tuesday_open_minutes": {
    "write": "no",
    "create": "no"
    },
    "tuesday_close_hour": {
    "write": "no",
    "create": "no"
    },
    "tuesday_close_minutes": {
    "write": "no",
    "create": "no"
    },
    "is_open_wednesday": {
    "write": "no",
    "create": "no"
    },
    "wednesday_open_hour": {
    "write": "no",
    "create": "no"
    },
    "wednesday_open_minutes": {
    "write": "no",
    "create": "no"
    },
    "wednesday_close_hour": {
    "write": "no",
    "create": "no"
    },
    "wednesday_close_minutes": {
    "write": "no",
    "create": "no"
    },
    "is_open_thursday": {
    "write": "no",
    "create": "no"
    },
    "thursday_open_hour": {
    "write": "no",
    "create": "no"
    },
    "thursday_open_minutes": {
    "write": "no",
    "create": "no"
    },
    "thursday_close_hour": {
    "write": "no",
    "create": "no"
    },
    "thursday_close_minutes": {
    "write": "no",
    "create": "no"
    },
    "is_open_friday": {
    "write": "no",
    "create": "no"
    },
    "friday_open_hour": {
    "write": "no",
    "create": "no"
    },
    "friday_open_minutes": {
    "write": "no",
    "create": "no"
    },
    "friday_close_hour": {
    "write": "no",
    "create": "no"
    },
    "friday_close_minutes": {
    "write": "no",
    "create": "no"
    },
    "is_open_saturday": {
    "write": "no",
    "create": "no"
    },
    "saturday_open_hour": {
    "write": "no",
    "create": "no"
    },
    "saturday_open_minutes": {
    "write": "no",
    "create": "no"
    },
    "saturday_close_hour": {
    "write": "no",
    "create": "no"
    },
    "saturday_close_minutes": {
    "write": "no",
    "create": "no"
    },
    "address": {
    "write": "no",
    "create": "no"
    },
    "sunday_hours": {
    "write": "no",
    "create": "no"
    },
    "monday_hours": {
    "write": "no",
    "create": "no"
    },
    "tuesday_hours": {
    "write": "no",
    "create": "no"
    },
    "wednesday_hours": {
    "write": "no",
    "create": "no"
    },
    "thursday_hours": {
    "write": "no",
    "create": "no"
    },
    "friday_hours": {
    "write": "no",
    "create": "no"
    },
    "saturday_hours": {
    "write": "no",
    "create": "no"
    }
    },
    "admin": "no",
    "developer": "no",
    "edit": "no",
    "delete": "no",
    "import": "no",
    "massupdate": "no",
    "create": "no",
    "_hash": "7b28cd3c934e75eb9e51e00f499f647a"
    }
    },
    "business_center_id": "",
    "source": "",
    "request_close": false,
    "request_close_date": "",
    "portal_viewable": true,
    "widget_status": "",
    "primary_contact_name": "",
    "case_contact": {
    "name": "",
    "id": "",
    "_acl": {
    "fields": {
    "dri_workflow_template_id": {
    "create": "no",
    "write": "no",
    "license": "no"
    },
    "dri_workflow_template_name": {
    "create": "no",
    "write": "no",
    "license": "no"
    }
    },
    "admin": "no",
    "developer": "no",
    "delete": "no",
    "import": "no",
    "export": "no",
    "massupdate": "no",
    "_hash": "fa530dfc673e1dd32ef98352a453e8df"
    }
    },
    "primary_contact_id": "",
    "action_claim": "",
    "action_close": "",
    "action_unassign": "",
    "following": false,
    "my_favorite": false,
    "tag": [],
    "locked_fields": [],
    "sync_key": "",
    "assigned_user_id": "0eee35f4-ffaf-11e6-87d4-",
    "assigned_user_name": "Athar",
    "assigned_user_link": {
    "full_name": "Athar Uddin",
    "id": "0eee35f4-ffaf-11e6-87d4-",
    "_acl": {
    "fields": {
    "user_name": {
    "write": "no",
    "create": "no"
    },
    "user_hash": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "system_generated_password": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "pwd_last_changed": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "authenticate_id": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "sugar_login": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "is_admin": {
    "write": "no",
    "create": "no"
    },
    "external_auth_only": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "last_login": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "title": {
    "write": "no",
    "create": "no"
    },
    "department": {
    "write": "no",
    "create": "no"
    },
    "status": {
    "write": "no",
    "create": "no"
    },
    "license_type": {
    "write": "no",
    "create": "no"
    },
    "portal_only": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "show_on_employees": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "employee_status": {
    "write": "no",
    "create": "no"
    },
    "reports_to_id": {
    "write": "no",
    "create": "no"
    },
    "reports_to_name": {
    "write": "no",
    "create": "no"
    },
    "reports_to_link": {
    "write": "no",
    "create": "no"
    },
    "is_group": {
    "read": "no",
    "write": "no",
    "create": "no"
    }
    },
    "admin": "no",
    "developer": "no",
    "edit": "no",
    "delete": "no",
    "import": "no",
    "massupdate": "no",
    "create": "no",
    "_hash": "9f4d3aa34f6c64d92457d5ffce1153d6"
    }
    },
    "team_count": "",
    "team_count_link": {
    "team_count": "",
    "id": "1",
    "_acl": {
    "fields": {
    "id": {
    "write": "no",
    "create": "no"
    },
    "name": {
    "write": "no",
    "create": "no"
    },
    "date_entered": {
    "write": "no",
    "create": "no"
    },
    "date_modified": {
    "write": "no",
    "create": "no"
    },
    "modified_user_id": {
    "write": "no",
    "create": "no"
    },
    "modified_by_name": {
    "write": "no",
    "create": "no"
    },
    "created_by": {
    "write": "no",
    "create": "no"
    },
    "created_by_name": {
    "write": "no",
    "create": "no"
    },
    "description": {
    "write": "no",
    "create": "no"
    },
    "deleted": {
    "write": "no",
    "create": "no"
    },
    "created_by_link": {
    "write": "no",
    "create": "no"
    },
    "modified_user_link": {
    "write": "no",
    "create": "no"
    },
    "activities": {
    "write": "no",
    "create": "no"
    },
    "name_2": {
    "write": "no",
    "create": "no"
    },
    "associated_user_id": {
    "write": "no",
    "create": "no"
    },
    "private": {
    "write": "no",
    "create": "no"
    },
    "users": {
    "write": "no",
    "create": "no"
    },
    "teams_sets": {
    "write": "no",
    "create": "no"
    },
    "activities_teams": {
    "write": "no",
    "create": "no"
    },
    "following": {
    "write": "no",
    "create": "no"
    },
    "following_link": {
    "write": "no",
    "create": "no"
    },
    "my_favorite": {
    "write": "no",
    "create": "no"
    },
    "favorite_link": {
    "write": "no",
    "create": "no"
    },
    "commentlog": {
    "write": "no",
    "create": "no"
    },
    "commentlog_link": {
    "write": "no",
    "create": "no"
    },
    "locked_fields": {
    "write": "no",
    "create": "no"
    },
    "locked_fields_link": {
    "write": "no",
    "create": "no"
    },
    "sync_key": {
    "write": "no",
    "create": "no"
    }
    },
    "admin": "no",
    "developer": "no",
    "edit": "no",
    "delete": "no",
    "import": "no",
    "massupdate": "no",
    "create": "no",
    "_hash": "3541cb8277009f1189bae2b0bb2dd64b"
    }
    },
    "team_name": [
    {
    "id": "1",
    "name": "Global",
    "name_2": "",
    "primary": true,
    "selected": false
    }
    ],
    "source_id": "",
    "source_type": "",
    "source_meta": "",
    "first_response_target_datetime": "",
    "first_response_actual_datetime": "",
    "hours_to_first_response": null,
    "business_hrs_to_first_response": null,
    "first_response_var_from_target": null,
    "first_response_sla_met": "",
    "first_response_user_id": "",
    "first_response_user_name": "",
    "first_response_user_link": {
    "full_name": "",
    "id": "",
    "_acl": {
    "fields": {
    "user_name": {
    "write": "no",
    "create": "no"
    },
    "user_hash": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "system_generated_password": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "pwd_last_changed": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "authenticate_id": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "sugar_login": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "is_admin": {
    "write": "no",
    "create": "no"
    },
    "external_auth_only": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "last_login": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "title": {
    "write": "no",
    "create": "no"
    },
    "department": {
    "write": "no",
    "create": "no"
    },
    "status": {
    "write": "no",
    "create": "no"
    },
    "license_type": {
    "write": "no",
    "create": "no"
    },
    "portal_only": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "show_on_employees": {
    "read": "no",
    "write": "no",
    "create": "no"
    },
    "employee_status": {
    "write": "no",
    "create": "no"
    },
    "reports_to_id": {
    "write": "no",
    "create": "no"
    },
    "reports_to_name": {
    "write": "no",
    "create": "no"
    },
    "reports_to_link": {
    "write": "no",
    "create": "no"
    },
    "is_group": {
    "read": "no",
    "write": "no",
    "create": "no"
    }
    },
    "admin": "no",
    "developer": "no",
    "edit": "no",
    "delete": "no",
    "import": "no",
    "massupdate": "no",
    "create": "no",
    "_hash": "9f4d3aa34f6c64d92457d5ffce1153d6"
    }
    },
    "first_response_sent": false,
    "is_escalated": false,
    "perform_sugar_action": false,
    "dnf_productn_cases_1_name": "",
    "dnf_production_cases_1_right": {
    "name": "",
    "id": "",
    "_acl": {
    "fields": [],
    "admin": "no",
    "developer": "no",
    "edit": "no",
    "delete": "no",
    "import": "no",
    "export": "no",
    "massupdate": "no",
    "create": "no",
    "_hash": "3b82fb104e6efff6fb99a43d8deec01b"
    }
    },
    "dnf_produc01f3duction_ida": "",
    "cre8_maufacturing_cases_1_name": "",
    "cre8_maufacturing_cases_1_right": {
    "name": "",
    "id": "",
    "_acl": {
    "fields": [],
    "admin": "no",
    "developer": "no",
    "access": "no",
    "view": "no",
    "list": "no",
    "edit": "no",
    "delete": "no",
    "import": "no",
    "export": "no",
    "massupdate": "no",
    "_hash": "9a88037db8b4b173849f52e006f93937"
    }
    },
    "cre8_maufacturing_cases_1cre8_maufacturing_ida": "",
    "cases_accounts_name": "",
    "cases_accounts": {
    "name": "",
    "id": "",
    "_acl": {
    "fields": {
    "dri_workflow_template_id": {
    "create": "no",
    "write": "no",
    "license": "no"
    },
    "dri_workflow_template_name": {
    "create": "no",
    "write": "no",
    "license": "no"
    }
    },
    "admin": "no",
    "developer": "no",
    "delete": "no",
    "import": "no",
    "export": "no",
    "massupdate": "no",
    "_hash": "fa530dfc673e1dd32ef98352a453e8df"
    }
    },
    "cases_acco7636ccounts_idb": "",
    "contacts_cases_1_name": "",
    "contacts_cases_1_right": {
    "full_name": "",
    "id": "",
    "_acl": {
    "fields": {
    "dri_workflow_template_id": {
    "create": "no",
    "write": "no",
    "license": "no"
    },
    "dri_workflow_template_name": {
    "create": "no",
    "write": "no",
    "license": "no"
    }
    },
    "admin": "no",
    "developer": "no",
    "delete": "no",
    "import": "no",
    "export": "no",
    "massupdate": "no",
    "_hash": "fa530dfc673e1dd32ef98352a453e8df"
    }
    },
    "contacts_cases_1contacts_ida": "",
    "invoice_number_c": "",
    "related_serial_numbers_c": "",
    "custom_worklog_c": "",
    "invoice_date_c": "",
    "reason_c": "",
    "contact_fax_c": "",
    "contact_last_name_c": "",
    "contact_first_name_c": "",
    "contact_state_c": "",
    "contact_phone_c": "",
    "case_summary_c": "test",
    "product_name_c": "",
    "quantity_c": "",
    "closeddate_c": "",
    "contact_address_c": "",
    "contact_zip_c": "",
    "case_type_c": "",
    "contact_email_c": "",
    "contact_city_c": "",
    "support_level_c": "",
    "support_charge_s_id": "",
    "rma_c": false,
    "test_html_field_c": "",
    "recordtypeid_c": "",
    "product_family_c": "",
    "origin_c": "",
    "case_session_summary_c": "",
    "denorm_account_name": "",
    "isescalated_c": false,
    "out_of_warranty_c": false,
    "suppliedcompany_c": "",
    "suppliedemail_c": "",
    "suppliedname_c": "",
    "suppliedphone_c": "",
    "support_charge_s_c": "",
    "survey_sent_c": false,
    "_acl": {
    "fields": {}
    },
    "_module": "Cases"
    }


    There is no attachment section in this response, although it have one attachment.

  • Hello  , 


    The payload that i've shared is not the response, it's the request. 
    Are you being able to upload the attachments with the payload shared? 

    Cheers, 

    André  

  •  
    No, I can't
    Can you please help to do so?
    I want to add a case with its subject line, description and attachments.
    I am using Curl PHP for this

Reply Children
  • Hello  , 

    You'll need to break down the process in two steps. 

    The examples bellow are assuming that you already retrieved an OAuth Token from Sugar. 

     1 - Upload the Attachments, on my example the attachment file is called attachment.png  

    Fullscreen
    1
    2
    3
    4
    curl 'https://YOUR_INSTANCE_URL/rest/v11_24/Notes/temp/file/filename?delete_if_fails=true&platform=base' \
    -H 'OAuth-Token: REPLACE_WITH_OAUTH_TOKEN' \
    -H 'Content-Type: multipart/form-data' \
    -F "filename=@attachment.png"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      

    2 - Create the Case, Make sure to replace "REPLACE_WITH_ATTACHMENT_ID" with the actual id you receive from the first request.  

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    curl 'https://YOUR_INSTANCE_URL/rest/v11_24/Cases' \
    -H 'OAuth-Token: REPLACE_WITH_OAUTH_TOKEN' \
    -H 'Content-Type: application/json' \
    --data-raw '{
    "name": "This is the subject of my test",
    "description": "This is the description",
    "attachments": {
    "create": [
    {
    "_link": "attachments",
    "name": "attachment.png",
    "filename_guid": "REPLACE_WITH_ATTACHMENT_ID",
    "filename": "attachment.png",
    "file_mime_type": "image/png",
    "file_size": 2335,
    "file_ext": "png",
    "portal_flag": true,
    "deleted": false
    }
    ],
    "add": [],
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Let me know if this example leads you on the correct direction. 

    Cheers,   

    André 

  •  

    Thanks for your help

    It worked

    Thank you once again buddy

  • Please also guide me about multiple uploads and how to get this attachment in a case on some listing page?
    It's not present in the response that I get on the listing page.

  • Nice! I am happy that I helped! 

  • Hello  , 


    If you need multiple attachments at the time of Case creation, the approach will be similar. You'll need to upload them to Sugar and then relate them to the case in the case creation request. 

    A good approach is to observe how Sugar handles the same scenario in Graphic User Interface and copy it to your code:

    www.screencast.com/.../OaGqvIsj5bb

    Regarding the Listing page, I am not sure what you mean by that. 
    Can you clarify? 

  •  
    Like i wanna get the same case on some case detail page where I show its case name, description and that attachments too.

  • Like i wanna get the same case on some case detail page where I show its case name, description and that attachments too.

  •   

    like in this example

    //Get An Attachment on a Note
    $url = $instance_url . "/Notes/{$noteRecord->id}/file/filename";


    It says the noteRecord->id in request 
    but when I get the case with the attachment there is no note_id in it.
    So help me out to get the attachment attached to the case now

  • Hello  , 


    If you hit the GET endpoint for the case record id you should be able to retrieve the note id's in the payload:

    Fullscreen
    1
    GET https://INSTANCE_URL/rest/v11_24/Cases/ee706e92-3538-11ef-b423-0684a87b501c
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    As you can see here: 

  • Thanks  

    I got this earlier