Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new ticket with attachment #8

Closed
mikelga opened this issue Dec 9, 2020 · 8 comments
Closed

Create new ticket with attachment #8

mikelga opened this issue Dec 9, 2020 · 8 comments

Comments

@mikelga
Copy link

mikelga commented Dec 9, 2020

Hi!

I am using Python to create new tickets with this code:

import requests

headers = {"Authorization": "Bearer TOKEN"}

payload = {
    "message": "Ticket Message",
    "actAsType": "customer",
    "name": "Name",
    "subject": "Ticket Subject",
    "from": "client@client.com",
}

r = requests.post("http://my_server/api/v1/ticket", data=payload, headers=headers)

print r.content

Now I want to know how can I create this same ticket but with attachment.

Thanks!

@papnoisanjeev
Copy link
Contributor

@mikelga
try with attachments key.

@mikelga
Copy link
Author

mikelga commented Dec 9, 2020

@mikelga
try with attachments key.

I have tried with "attachments": "text", but I have not got any result.

@papnoisanjeev
Copy link
Contributor

@mikelga

Try with "attachments": "file"

@mikelga
Copy link
Author

mikelga commented Dec 9, 2020

@mikelga

Try with "attachments": "file"

In what format need to go the attachments variable value?
I have tried with this cope sample but it does not upload any attachment:

import requests

with open("data_file.json", "rb") as file:
  f = file.read()

headers = {"Authorization": "Bearer TOKEN"}

payload = {
    "message": "Ticket Message",
    "actAsType": "customer",
    "name": "Name",
    "subject": "Ticket Subject",
    "from": "client@client.com",
    "attachments": f
}

r = requests.post("http://my_server/api/v1/ticket", data=payload, headers=headers)

print r.content

@phenomenalDenzel
Copy link

I have this same issue, I cant still create a ticket with an attachment. Please can you show an example on how to do that in code. Thank You.

@papnoisanjeev
Copy link
Contributor

papnoisanjeev commented Jan 19, 2021

@mikelga @phenomenalDenzel

1. For creating ticket attachment issue Locate path in your project:
vendor/uvdesk/api-bundle/API/Tickets.php
open Tickets.php and make change as done in below link:

e22e7ef

or directly copy and replace your existing file code from here.

2. For ticket reply attachment issue Locate path in your project:

vendor/uvdesk/api-bundle/API/Threads.php
open Threads.php and make change as done in below link:

e22e7ef

or directly copy and replace your existing file code from here.

@phenomenalDenzel
Copy link

Hy. Thank you very much for the reply. When i upload multiple attachments to uvdesk, it only uploads the last file in the set of files sent, and discards the rest. It is just like uvdesk does not accept an array of files when creating a ticket or replying to a ticket. It only takes one. Please help.

@papnoisanjeev
Copy link
Contributor

papnoisanjeev commented Feb 12, 2021

@phenomenalDenzel @mikelga
Issue has been fixed.
Check this: #12 (comment)

Closing the issue you can still open it if not working for you !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants