WebHook API header.  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Re: WebHook API header.

Postby Mike.Sheen » Mon Jul 01, 2024 6:32 pm

Ernst wrote:The webhook is there..


No it isn't
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2473
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 764

Re: WebHook API header.

Postby Ernst » Mon Jul 01, 2024 6:59 pm

Yes we are running 2 API, the second one is Test, and this is the log from the second one.. Service2 folder.
User avatar
Ernst
Kohai
Kohai
 
Posts: 233
Joined: Tue Feb 19, 2008 3:43 pm
Topics Solved: 12

Re: WebHook API header.

Postby Ernst » Mon Jul 01, 2024 7:01 pm

Isnt this it?? It says Webhook event?

1 2024-07-01T04:12:00.6954557Z 200 OK POST http://localhost:82/Webhooks/Events /Webhooks/Events/ {EventName:salesorder.updated,Body:"{""SystemSettings"":{""ForceInventorySelection"":false,""SuppressLineRetotalling"":false,""IgnoreDebtorOnHold"":false,""CompensateTaxRounding"":false},""LastSavedDateTime"":""\/Date(1719804926503-0000)\/"",""InitiatedDate"":""\/Date(1716897600000-0000)\/"",""InvoiceInitDate"":""\/Date(1716897600000-0000)\/"",""SalesOrderType"":""e_SalesOrderNormalSalesOrder"",""OrderType"":""e_SalesOrderOrderTypeReserveOrder"",""Status"":""e_SalesOrderEntered"",""EDIStatus"":""e_SalesOrderHistoryEDIPickStatusNone"",""BillType"":""e_SalesOrderShipAndBill"",""ExpectedDeliveryDate"":""\/Date(1716953169853-0000)\/"",""DeliveredDate"":""\/Date(-62135596800000-0000)\/"",""Delivered"":false,""EDIPickStatus"":""e_SalesOrderHistoryEDIPickStatusNone"",""EDIOrderType"":""e_SalesOrderEDIOrderTypeNormal"",""EDIDeliverNotBeforeDate"":""\/Date(-62135596800000-0000)\/"",""EDIDeliverNotAfterDate"":""\/Date(-62135596800000-0000)\/"",""CashSales"":{""Name"":"""",""Company"":"""",""Address1"":"""",""Address2"":"""",""Address3"":"""",""Address4"":"""",""PostCode"":"""",""Phone"":"""",""Fax"":"""",""ContactName"":""""},""DropShipment"":false,""Cartage1ExGst"":10.000000,""Cartage1GstRate"":15.000000,""Cartage1Gst"":1.500000,""Cartage2ExGst"":0.000000,""Cartage2GstRate"":15.000000,""Cartage2Gst"":0.000000,""Cartage3ExGst"":0.000000,""Cartage3GstRate"":15.000000,""Cartage3Gst"":0.000000,""JobCosting"":{""GSTApplicable"":false,""JobCostID"":"""",""JobCostNo"":"""",""Description"":""""},""InvoiceID"":""1c623635899e4f79ad81"",""InvoiceNo"":""53567"",""LogicalID"":""ZZZZZZZZZZ0000000000"",""LogicalWarehouseDescription"":""Wellington"",""PhysicalWarehouseDescription"":""Medent"",""CreditNote"":false,""StaffID"":""c5783f2031364812a5f2"",""StaffUserName"":""Michael"",""StaffTitle"":""Mr"",""StaffFirstName"":""Michael"",""StaffSurname"":""Quirke"",""BranchID"":""ZZZZZZZZZZ0000000000"",""BranchDescription"":""Default"",""BranchName"":""Default"",""OrderNo"":""Test"",""SOReference"":""143"",""SenderEDIAddress"":"""",""ReceiverEDIAddress"":"""",""EDIVendorNumber"":"""",""EDIBuyerNumber"":"""",""DebtorID"":""000015a5288e4cd5ae13"",""DebtorAccountNo"":""ORE942"",""DebtorName"":""OREWA MEDICAL CENTRE"",""DebtorEmailAddress"":"""",""EDIASN"":"""",""DeliveryAddressee"":""OREWA MEDICAL CENTRE"",""DeliveryAddress1"":""8D TAMARIKI AVE"",""DeliveryAddress2"":"""",""DeliveryAddressSuburb"":""OREWA"",""DeliveryAddressState"":""AUCKLAND"",""DeliveryAddressContactName"":""123123"",""DeliveryAddressPostcode"":""1233"",""DeliveryAddressCountry"":"""",""DeliveryAddressNotes"":"" PROMO"",""DeliveryAddressCourierDetails"":"""",""CustomFieldValues"":[],""Notes"":[],""Documents"":[],""Payments"":[{""HistoryNo"":1,""PaymentType"":{""PaymentTypeID"":""ZZZZZZZZZZ0000000000 "",""Name"":""Direct Credit"",""Code"":""DC"",""GeneralLedgerAccount"":{}},""AmountPaid"":182.910000,""PaymentDate"":""\/Date(1716953169917-0000)\/"",""ProcessPayment"":true,""AuthorisationStatus"":""NoAuthorisationNeeded"",""PaymentGatewayReturnCode"":0,""Processed"":false,""CardExpiry"":""\/Date(-62135596800000-0000)\/"",""PaymentID"":""a5c500b7644742918340"",""PaymentRef"":"""",""AuthorisationNumber"":"""",""PaymentGatewayReturnMessage"":"""",""CardNumber"":"""",""CardHolder"":"""",""BankName"":"""",""BSBN"":"""",""BankAcc"":"""",""AccountName"":""""}],""Lines"":[{""ItemNo"":1,""CommentLine"":true,""QuantityOrdered"":0.000000,""QuantityDemand"":0.000000,""QuantityThisDel"":0.000000,""QuantityBackOrd"":0,""Picked"":false,""PriceExGst"":0.000000,""PriceIncGst"":0.000000,""DiscountedPrice"":0.000000,""TaxToCharge"":0.000000,""TaxRate"":{""RecID"":"""",""Description"":"""",""Rate"":0.000000,""BASCode"":0,""LedgerAccount"":{""LedgerID"":"""",""AccountNo"":"""",""Description"":""""}},""UnitCost"":0,""FixSellPrice"":false,""FixPrice"":false,""UserDefinedFloat1"":0.000000,""UserDefinedFloat2"":0.000000,""UserDefinedFloat3"":0.000000,""ForwardOrderDate"":""\/Date(1716953169853-0000)\/"",""ScheduledDate"":""\/Date(1716953169853-0000)\/"",""LineTotal"":0.000000,""Weight"":0.000000,""Cubic"":0.000000,""QuotedDiscountedPrice"":0,""QuotedDiscountPercentage"":0,""DiscountedPercentage"":0.000000,""DiscountGiven"":0.000000,""QuantityDecimalPlaces"":0,""QuantityOriginalOrdered"":0.000000,""NonInventory"":false,""InvoiceLineID"":""1c276f1585d84e41a777"",""InventoryID"":"""",""PartNo"":""Comment Line"",""Description"":"""",""CommentText"":""PROMO"",""Aux2"":"""",""LineLinkID"":"" "",""EDIStoreLocationCode"":"""",""EDIDCLocationCode"":"""",""CustomFieldValues"":[],""LineDetails"":[{""Cost"":0.000000,""DateIn"":""\/Date(-62135596800000-0000)\/"",""ExpiryDate"":""\/Date(-62135596800000-0000)\/"",""SpecialPrice"":0.000000,""Quantity"":0.000000,""LineDetailID"":""ea405097e9ca45c593b3"",""BinLocation"":"""",""SerialNo"":"""",""SOHID"":"""",""IN_LogicalID"":""""}],""ShippingLabels"":[],""KitLineType"":""e_SalesOrderNormalLine"",""KitUnits"":0.000000},{""ItemNo"":2,""CommentLine"":false,""QuantityOrdered"":1,""QuantityDemand"":0,""QuantityThisDel"":0,""QuantityBackOrd"":1,""Picked"":false,""PriceExGst"":159.05,""PriceIncGst"":182.91,""DiscountedPrice"":159.05,""TaxToCharge"":0.00,""TaxRate"":{""RecID"":""GST02000000000000000"",""Description"":""GST Out(15%)"",""Rate"":15.000000,""BASCode"":1,""LedgerAccount"":{""LedgerID"":""6eaaffaed5d24c9189ad"",""AccountNo"":""2200-01"",""Description"":""GST on Sales Tax Control Account""}},""UnitCost"":94.330000,""FixSellPrice"":false,""FixPrice"":false,""UserDefinedFloat1"":0.000000,""UserDefinedFloat2"":0.000000,""UserDefinedFloat3"":0.000000,""ForwardOrderDate"":""\/Date(1716953169853-0000)\/"",""ScheduledDate"":""\/Date(1716953169853-0000)\/"",""LineTotal"":0.00,""Weight"":0.000000,""Cubic"":0.000000,""QuotedDiscountedPrice"":0,""QuotedDiscountPercentage"":0,""DiscountedPercentage"":0.000000,""DiscountGiven"":0.00,""QuantityDecimalPlaces"":0,""QuantityOriginalOrdered"":2.000000,""NonInventory"":false,""InvoiceLineID"":""776b5a716b754c72b265"",""InventoryID"":""894b95cdde4f46d9980f"",""PartNo"":""10003"",""Description"":""DELTA CAST ELITE BLACK 7.5CM X 3.6M 10'S "",""CommentText"":"""",""Aux2"":""BACAD21"",""LineLinkID"":"" "",""EDIStoreLocationCode"":"""",""EDIDCLocationCode"":"""",""CustomFieldValues"":[],""LineDetails"":[],""ShippingLabels"":[],""KitLineType"":""e_SalesOrderNormalLine"",""KitUnits"":0.000000}],""Histories"":[{""InvoiceHistoryID"":""1f76a99e0e234d579a1e"",""HistoryNo"":1,""Status"":""e_SalesOrderHistoryStatusEntering"",""EDIPickStatus"":""e_SalesOrderHistoryEDIPickStatusNone"",""DBTransID"":"" "",""Ref"":""D01 - Modified By Admin 01/07/2024 16:11:59"",""LastModifiedBy"":""Admin"",""HistoryTotal"":0.00,""AmountPaid"":182.910000,""TotalQuantityDelivered"":0.000000,""RunNo"":"" "",""Delivered"":false,""DeliveredDate"":""\/Date(-62135596800000-0000)\/"",""RecordDate"":""\/Date(1719807119836+1200)\/"",""DateCreated"":""\/Date(1716953170433-0000)\/"",""DateLastSaved"":""\/Date(1719804926517-0000)\/"",""DatePosted"":""\/Date(1719807119836+1200)\/"",""InvoicePrinted"":false,""DocketPrinted"":false,""PackSlipPrinted"":false,""PickSheetPrinted"":false,""OtherPrinted"":false,""InvoiceEmailed"":false,""DocketEmailed"":false,""PackSlipEmailed"":false,""PickSheetEmailed"":false,""OtherEmailed"":false,""DeliveryAddressContactName"":""123123"",""DeliveryAddressee"":""OREWA MEDICAL CENTRE"",""DeliveryAddress1"":""8D TAMARIKI AVE"",""DeliveryAddress2"":"""",""DeliveryAddress3"":""OREWA"",""DeliveryAddress4"":""AUCKLAND"",""DeliveryAddressPostcode"":""1233"",""DeliveryAddressCountry"":"""",""Notes"":"" PROMO"",""CourierDetails"":"""",""FreightForwardAddress1"":"""",""FreightForwardAddress2"":"""",""FreightForwardAddress3"":"""",""FreightForwardAddress4"":"""",""FreightForwardAddressCountry"":"""",""FreightForwardAddressNotes"":"""",""ConsignmentNote"":"""",""EDIASNNumber"":"""",""DropShipment"":false,""CartageCharge1"":{""ExTaxAmount"":10.000000,""TaxAmount"":1.500000,""TaxRate"":{""RecID"":""GST02000000000000000"",""Description"":""GST Out(15%)"",""Rate"":15.000000,""BASCode"":1,""LedgerAccount"":{""LedgerID"":""6eaaffaed5d24c9189ad"",""AccountNo"":""2200-01"",""Description"":""GST on Sales Tax Control Account""}}},""CartageCharge2"":{""ExTaxAmount"":0.000000,""TaxAmount"":0.000000,""TaxRate"":{""RecID"":""GST02000000000000000"",""Description"":""GST Out(15%)"",""Rate"":15.000000,""BASCode"":1,""LedgerAccount"":{""LedgerID"":""6eaaffaed5d24c9189ad"",""AccountNo"":""2200-01"",""Description"":""GST on Sales Tax Control Account""}}},""CartageCharge3"":{""ExTaxAmount"":0.000000,""TaxAmount"":0.000000,""TaxRate"":{""RecID"":""GST02000000000000000"",""Description"":""GST Out(15%)"",""Rate"":15.000000,""BASCode"":1,""LedgerAccount"":{""LedgerID"":""6eaaffaed5d24c9189ad"",""AccountNo"":""2200-01"",""Description"":""GST on Sales Tax Control Account""}}},""Carrier"":{""CarrierID"":"""",""AccountNo"":"""",""UseLeastCost"":false,""ChargeTo"":""FreightChargeToSender"",""Status"":""FreightSystemStatusNone"",""FreightItemCollection"":[],""ConsignmentNoteCollection"":[]},""CustomFieldValues"":[]}],""ASNs"":[],""CreditReason"":{""CreditIntoStock"":false}}",SourceDTOType:JiwaFinancials.Jiwa.JiwaServiceModel.SalesOrders.SalesOrder,SourceDTOID:1c623635899e4f79ad81} Z5SiXGD2Ln4guPyj8FoY ::1 {ClientKey:7+Sc8n7hqBwBICt1ICEQpA==,Request-Id:|70557b92-4a52ce6089b35c03.,Connection:Keep-Alive,Content-Length:9445,Content-Type:application/json,Accept:application/json,Accept-Encoding:"gzip,deflate",Expect:100-continue,Host:"localhost:82",User-Agent:ServiceStack .NET Client 5.10} {} {__route:ServiceStack.Host.RestPath,__haspreauth:True,ss-pid:F1tKGBnKpwnREA85qX38,ss-id:Z5SiXGD2Ln4guPyj8FoY,__session:JiwaFinancials.Jiwa.JiwaServiceModel.JiwaAuthUserSession,_requestDurationStopwatch:System.Diagnostics.Stopwatch,_logged:True} PT0.4522188S
User avatar
Ernst
Kohai
Kohai
 
Posts: 233
Joined: Tue Feb 19, 2008 3:43 pm
Topics Solved: 12

Re: WebHook API header.

Postby Mike.Sheen » Mon Jul 01, 2024 7:02 pm

Ernst wrote:Isnt this it?? It says Webhook event?


Depends.

Do you really have a second API acting as the webhook receiver?
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2473
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 764

Re: WebHook API header.

Postby Ernst » Mon Jul 01, 2024 7:05 pm

No we dont have sender and receiver API's, we have a live API and a second Test API service. The line in the log seems to indicate, its from the webhook. Could I just add a write file, just before the post.

And write out what the post is going to look like?
User avatar
Ernst
Kohai
Kohai
 
Posts: 233
Joined: Tue Feb 19, 2008 3:43 pm
Topics Solved: 12

Re: WebHook API header.

Postby Mike.Sheen » Mon Jul 01, 2024 7:08 pm

Ernst wrote:Isnt this it?? It says Webhook event?


I see the confusion here - but no, this is not the webhook being sent to the subscriber.

This is the POST the Jiwa clients do to the REST API which will then perform a POST to the subscribers - it's not supposed to have any extra headers you may have added to the subscriber.

That is done by the REST API service, and outbound webhooks to the subscribers are not logged to the request logs folder.

Please study the diagram on the webhooks docs page to understand how it hangs together.

What you are seeing in that log is the internal HTTP POST to the REST API by Jiwa clients.

You need to do as Stuart suggested to inspect the headers being sent to subscribers.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2473
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 764

Re: WebHook API header.

Postby Mike.Sheen » Mon Jul 01, 2024 7:13 pm

Ernst wrote:The line in the log seems to indicate, its from the webhook.


Trust me, it is not. You are not understanding how it works.

Ernst wrote:Could I just add a write file, just before the post.
And write out what the post is going to look like?


No, the REST API service will, for each subscriber, add the headers and perform the POST to each subscriber.

You need to do as Stuart suggested. Just change the subscription URL to point to webhook.site (visit https://webhook.site/ to get a unique URL), then restart the Jiwa REST API Service, perform an action to generate a webhook an then go back to https://webhook.site/ and look at the request that came in.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2473
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 764

Re: WebHook API header.

Postby Mike.Sheen » Mon Jul 01, 2024 7:14 pm

Mike.Sheen wrote:
Ernst wrote:The line in the log seems to indicate, its from the webhook.


Trust me, it is not. You are not understanding how it works. What you are seeing is the internal POST from the Jiwa clients to the REST API Service, not the actual webhook we send to subscriptions.

Ernst wrote:Could I just add a write file, just before the post.
And write out what the post is going to look like?


No, the REST API service will, for each subscriber, add the headers and perform the POST to each subscriber.

You need to do as Stuart suggested. Just change the subscription URL to point to webhook.site (visit https://webhook.site/ to get a unique URL), then restart the Jiwa REST API Service, perform an action to generate a webhook an then go back to https://webhook.site/ and look at the request that came in.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2473
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 764

Re: WebHook API header.

Postby Ernst » Mon Jul 01, 2024 7:16 pm

OK, a job for tomorrow then, its getting past my bedtime already.. Thx for Advice Stuart and Mike..
User avatar
Ernst
Kohai
Kohai
 
Posts: 233
Joined: Tue Feb 19, 2008 3:43 pm
Topics Solved: 12

Previous

Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 7 guests