简体   繁体   中英

Using Freshdesk API

Does anyone have any experience using the FRESHDESK API http://freshdesk.com/api/ to create tickets?

It says this in the documentation

Request URL: domain_URL/helpdesk/tickets.xml
Request method: POST

<helpdesk_ticket>
  <description>Disk failure problem</description>    <!--Mandatory -->
  <email>sample@example.com</email>                <!--Mandatory -->
  <priority>1</priority>                           <!-- Optional -->
  <status>2</status>                               <!-- Optional -->
</helpdesk_ticket>     

But Im a little unsure how to use this in my HTML code, so I've tried using this

 %form.stacked_form{:action => "http://onehouse.freshdesk.com/helpdesk/tickets.xml", :method => "POST"}

in my form and it seems to post the ticket to the FRESHDESK site with the relevant information.

However it sends me to an XML page that says:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

and I get a bunch of this stuff

<helpdesk-ticket>
  <cc-email type="yaml">--- :fwd_emails: [] :cc_emails: []</cc-email>
  <created-at type="datetime">2013-07-30T13:04:18-07:00</created-at>
  <deleted type="boolean">false</deleted>
  <delta type="boolean">true</delta>
  <description>Not given.</description>
  <description-html><div>Not given.</div></description-html>
  <display-id type="integer">42</display-id>
  <due-by type="datetime">2013-08-02T13:04:17-07:00</due-by>
  <email-config-id type="integer" nil="true"/>
  <frDueBy type="datetime">2013-07-31T13:04:17-07:00</frDueBy>
  <fr-escalated type="boolean">false</fr-escalated>
  <group-id type="integer" nil="true"/>
  <id type="integer">17054416</id>
  <isescalated type="boolean">false</isescalated>
  <owner-id type="integer" nil="true"/>
  <priority type="integer">1</priority>
  <requester-id type="integer">5947991</requester-id>
  <responder-id type="integer" nil="true"/>
  <source type="integer">2</source>
  <spam type="boolean">false</spam>
  <status type="integer">2</status>
 <subject/>
  <ticket-type>Lead</ticket-type>
  <to-email nil="true"/>
  <trained type="boolean">false</trained>
  <updated-at type="datetime">2013-07-30T13:04:18-07:00</updated-at>
  <urgent type="boolean">false</urgent>
  <status-name>Open</status-name>
  <requester-status-name>Being Processed</requester-status-name>
  <priority-name>Low</priority-name>
  <source-name>Portal</source-name>
  <requester-name>Richard Ahn</requester-name>
  <responder-name>No Agent</responder-name>
  <notes type="array"/>
  <attachments type="array"/>
  <to_emails></to_emails>
  <custom_field></custom_field>
 </helpdesk-ticket>

I'm a little unsure what I am suppose to do to resolve this... after I hit submit the ticket does get CREATED and on the freshdesk website I can see my ticket request.

I just need a way to get it to either redirect or send some sort of confirmation flash message to the user saying YOUR REQUEST HAS BEEN SENT...

If anyone has any info they can give me that would be great.

You need to send your request using JavaScript and redirect the user to a success page if the returned XML ticket data is valid.

Instead of redirecting you can also just use JavaScript to show some div containing the message.

Do not submit a form to a REST web service if you don't want to redirect the user to the result of the REST service.

默认情况下,跨域请求不允许使用XML( 请参阅此处 )。您可以使用跨源访问和JSON格式的v2 API。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM