OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums 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 8 years, 3 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #34044

    archy_bold
    Participant

    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.

    Thanks,
    Simon

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

    Tom Holland
    Participant

    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).

    Tom

    #34046

    archy_bold
    Participant

    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)

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

Back to top