Covering OroCRM topics, including community updates and company announcements.  Subscribe

Forums OroPlatform OroPlatform – Programming Questions Call API Endpoint On Action

This topic contains 2 replies, has 2 voices, and was last updated by  archy_bold 2 years, 1 month ago.

  • Creator
  • #60495


    Hi there. I’m building an OroCRM bundle to integrate with a bespoke ecom system.

    I’ve created my custom order entities and their views and I’m successfully receiving order information from the ecom site. Now I’d like to add a ‘cancel order’ button to the order view page. This would only change the status of the order, and would then need to call an endpoint on the ecom site’s API to cancel that order.

    Since it won’t be updating the order through a REST API, and would need to call a specific endpoint, what would be the best way to do this? I’d prefer for it to be done immediately rather than in a batch job.

    I am currently updating the status without problems in Oro, so I just need to know how to call the API endpoint, really.


Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #60496

    Tom Holland

    Hello Simon,

    I believe the best way to do this is with a process. You would need to define a process that triggers on update of your order entity. That process would use use the @call_method action to call custom code that uses cURL to hit your endpoint if the condition of $order.cancelled is true(or something like that).




    Thanks Tom, that’s really useful stuff to know about. Thanks.

    Actually, in the context of this, the API call needs to be done first so I’ve decided to create a service to bridge the gap to the integration transport which I can get access to in the controller. Also, I don’t know if I’d be comfortable putting direct cURL requests in an entity. But this will be super useful for something else I’m doing elsewhere.

    Thanks again for the help Tom.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.