简体   繁体   English

使用Freshdesk API

[英]Using Freshdesk API

Does anyone have any experience using the FRESHDESK API http://freshdesk.com/api/ to create tickets? 有没有人有使用FRESHDESK API http://freshdesk.com/api/创建票证的经验?

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 但是我有点不确定如何在我的HTML代码中使用它,因此我尝试使用它

 %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. 以我的表格发送,并且似乎将机票与相关信息一起发布到了FRESHDESK网站。

However it sends me to an XML page that says: 但是,它将我发送到一个XML页面,其中显示:

This XML file does not appear to have any style information associated with it. 此XML文件似乎没有与之关联的任何样式信息。 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. 我有点不确定该怎么做才能解决此问题……点击提交后票证确实创建了,在freshdesk网站上可以看到我的票证请求。

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... 我只需要一种方法使其重定向或向用户发送某种确认Flash消息,说您的请求已发送...

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. 如果返回的XML票证数据有效,则需要使用JavaScript发送请求并将用户重定向到成功页面。

Instead of redirecting you can also just use JavaScript to show some div containing the message. 除了重定向之外,您还可以仅使用JavaScript来显示包含消息的div。

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. 如果您不想将用户重定向到REST服务的结果,请不要向REST Web服务提交表单。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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