How to receive purchase order updates

59 views
Skip to first unread message

Rajat Garg - Prestele IT

unread,
Feb 21, 2021, 11:34:55 PM2/21/21
to Accelo Developers

Hi Team,

I want to use the Webhook functionality for the invoice or purchase order creation. I have registered the webhook on the Invoice PDF created and Purchase order pdf created event and it is working as expected by hitting the provided URL. Acc. to the documentation ( https://affinitylive.jira.com/wiki/spaces/APIS/pages/83951623/Webhooks ), the response should consist of a resource_url which should be like: 

  "resource_url": "https://bobs-burgers.api.accelo.com/api/v0/issues/1.json"

 But it is giving the following response:

   "resource_url":"https://dev.api.accelo.com/api/v0/resources/311.json",

The resource_url should contain the attached event like invoices or purchases, but it is generating a common URL that contains resources and sending the HTTP request to this endpoint does not return any information (like id) of the created invoice/purchase order.  

Is there any configuration that I have missed? Or it is not possible to get the correct resource. 

Thanks

Nick Clark

unread,
Feb 21, 2021, 11:42:51 PM2/21/21
to Accelo Developers
Hi Rajat.

Could you please try the following request?

Regards,
Nick 

Rajat Garg - Prestele IT

unread,
Feb 22, 2021, 12:51:14 PM2/22/21
to Accelo Developers
Yes, I have send a GET request on the above endpoint  https://dev.api.accelo.com/api/v0/resources/311.json and it has returned the following response:
"response": {
        "id": "311",
        "title": "title-6.pdf",
        "collection_id": "1293",
        "owner": {},
        "owner_id": "2",
        "date_created": "1613742947",
        "owner_type": "staff",
        "filesize": "19107",
        "mimetype": "application/pdf"
    } 

This response does not contain the id of the created resource. This is the second purchase order so ideally, it should return the id 2 instead of 311. The ID 311 is the resource id, so I can't do GET on https://dev.api.accelo.com/api/v0/purchases/311, it is returning 400. So, I don't know which resource just got created. Acc. to the documentation the expected behavior would have purchases in the resources_url instead of resources like "https://bobs-burgers.api.accelo.com/api/v0/purchases/1.json".   

1. Is it not possible to have the specific events in the resource_url like purchase/invoices etc.
2. How can I get the id of the created resource in the webhook response. 

Thanks

Nick Clark

unread,
Feb 22, 2021, 10:12:51 PM2/22/21
to Accelo Developers
Hi Rajat,

Would the following help, if you first run the request to list the most recent filter id:
{{url}}/api/v0/resources/?_filters=order_by_desc(id)

This will then return your most recent resource ID which can be used in your original request?

Will this help?

Regards,
Nick 

Rajat Garg - Prestele IT

unread,
Feb 24, 2021, 1:04:03 AM2/24/21
to Accelo Developers

NO, this is not an optimal solution. Multiple invoices/purchase orders may get created at the same time. So, it may result in the processing of the wrong data. Also, I have tried the following GET request:

https://dev.api.accelo.com/api/v0/resources/?_filters=order_by_desc(316)  # In the id, I have passed 316which is the resource id returned by the webhook response.

But the response of the above request is not returning the created/updated resource Id instead it is returning the array of some random invoices.

"response": [

        {

            "id": "174",

            "title": "invoice_23.pdf"

        },

        {

            "title": "invoice_23-1.pdf",

            "id": "175"

        },

        {

            "title": "invoice_37.pdf",

            "id": "176"

        }

    ]

Is it not possible to achieve the created purchase order/invoice id through webhook response? The expectation from Webhook's response is to provide information like the id of the created invoice/purchase order.

Nick Clark

unread,
Mar 11, 2021, 11:36:05 PM3/11/21
to Accelo Developers
Hi Rajat. 

Unfortunately, I do not think this will be possible please consider adding this item to our Ideas Forum where we can gather feedback around potentially adding this functionality to our roadmap. If will also be helpful if you could detail your use case for this functionality.


Kind regards,


Reply all
Reply to author
Forward
0 new messages