UPS API to get Shipping and Delivery details - ups

I am trying to integrate UPS QuantumView API to get shipping and delivery details for a particular time range (last 6 days starting from today), but it looks like my script is completely ignoring the DateTimeRange and displaying all the shipment details starting from 2001. My xml is:
$startDate = date("YmdHms", strtotime("now -6 day"));
$endDate = date("YmdHms", strtotime("now"));
<?xml version="1.0"?>
<AccessRequest xml:lang="en-US">
<AccessLicenseNumber>XXXXXXXXXX</AccessLicenseNumber>
<UserId>XXXXXX</UserId>
<Password>XXXXXXX</Password>
</AccessRequest>
<?xml version="1.0"?>
<QuantumViewRequest xml:lang="en-US">
<Request>
<RequestAction>QVEvents</RequestAction>
</Request>
<SubscriptionRequest>
<DateTimeRange>
<BeginDateTime>'.$startDate.'</BeginDateTime>
<EndDateTime>'.$endDate.'</EndDateTime>
</DateTimeRange>
</SubscriptionRequest>
</QuantumViewRequest>
Can anyone help me in pointing out where I am wrong?
Thanks

Make sure you select what subscription you want.
<SubscriptionRequest>
<Name>Your subscription name</Name>
<DateTimeRange>
Make sure the quantum view subscription is setup to be in xml format.

Related

EWS GetStreamingEvents returns access error

I am using a event notification subscription to get notified about new mail, etc. For one of our customers I get strange errors that I can't explain or fix.
The error is:
Access is denied. Only the subscription owner may access the subscription.
According the documentation this error is generated when the authenticated user for the subscription is different than the user for the GetEvents request. In my case the authorization header for both requests is exactly the same. Also I checked the subscription id to be the same.
The server is outlook.office365.com. This only happens on the email account for the customer. On our own email account it is all fine.
Can anybody shed some light on this? Thx.
This is the subscription request (all xmlns attributes have been removed):
EwsRequest:
<Trace Tag="EwsRequest" Tid="53" Time="2020-10-24 22:00:52Z" Version="2.2.1.0">
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope>
<soap:Header>
<t:RequestServerVersion Version="Exchange2016" />
</soap:Header>
<soap:Body>
<m:Subscribe>
<m:StreamingSubscriptionRequest>
<t:FolderIds>
<t:DistinguishedFolderId Id="inbox">
<t:Mailbox>
<t:EmailAddress>webreg#ds.dk</t:EmailAddress>
</t:Mailbox>
</t:DistinguishedFolderId>
</t:FolderIds>
<t:EventTypes>
<t:EventType>NewMailEvent</t:EventType>
<t:EventType>DeletedEvent</t:EventType>
<t:EventType>ModifiedEvent</t:EventType>
<t:EventType>MovedEvent</t:EventType>
</t:EventTypes>
</m:StreamingSubscriptionRequest>
</m:Subscribe>
</soap:Body>
</soap:Envelope>
</Trace>
and this is the response:
EwsResponse:
<Trace Tag="EwsResponse" Tid="53" Time="2020-10-24 22:00:52Z" Version="2.2.1.0">
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope >
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="3499" MinorBuildNumber="18" Version="V2018_01_08" />
</s:Header>
<s:Body>
<m:SubscribeResponse >
<m:ResponseMessages>
<m:SubscribeResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:SubscriptionId>JwBhbTdwcjA3bWI2NjI4LmV1cnByZDA3LnByb2Qub3V0bG9vay5jb20QAAAARQChc1Q/8EqY5NixfPmIikK4REZoeNgIEAAAAKQK6CUVOJlGvS0wpw59GqM=</m:SubscriptionId>
</m:SubscribeResponseMessage>
</m:ResponseMessages>
</m:SubscribeResponse>
</s:Body>
</s:Envelope>
</Trace>
This is the GetStreamingEvents request:
EwsRequest:
<Trace Tag="EwsRequest" Tid="53" Time="2020-10-24 22:00:52Z" Version="2.2.1.0">
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope >
<soap:Header>
<t:RequestServerVersion Version="Exchange2016" />
</soap:Header>
<soap:Body>
<m:GetStreamingEvents>
<m:SubscriptionIds>
<t:SubscriptionId>JwBhbTdwcjA3bWI2NjI4LmV1cnByZDA3LnByb2Qub3V0bG9vay5jb20QAAAARQChc1Q/8EqY5NixfPmIikK4REZoeNgIEAAAAKQK6CUVOJlGvS0wpw59GqM=</t:SubscriptionId>
</m:SubscriptionIds>
<m:ConnectionTimeout>30</m:ConnectionTimeout>
</m:GetStreamingEvents>
</soap:Body>
</soap:Envelope>
</Trace>
and this is the response:
EwsResponse:
<Trace Tag="EwsResponse" Tid="13" Time="2020-10-24 22:00:52Z" Version="2.2.1.0">
<Envelope>
<soap11:Header >
<ServerVersionInfo MajorVersion="15" MinorVersion="20" MajorBuildNumber="3499" MinorBuildNumber="18" Version="V2018_01_08" />
</soap11:Header>
<soap11:Body >
<m:GetStreamingEventsResponse >
<m:ResponseMessages>
<m:GetStreamingEventsResponseMessage ResponseClass="Error">
<m:MessageText>Access is denied. Only the subscription owner may access the subscription.</m:MessageText>
<m:ResponseCode>ErrorSubscriptionAccessDenied</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:ErrorSubscriptionIds>
<m:SubscriptionId>JwBhbTdwcjA3bWI2NjI4LmV1cnByZDA3LnByb2Qub3V0bG9vay5jb20QAAAARQChc1Q/8EqY5NixfPmIikK4REZoeNgIEAAAAKQK6CUVOJlGvS0wpw59GqM=</m:SubscriptionId>
</m:ErrorSubscriptionIds>
</m:GetStreamingEventsResponseMessage>
</m:ResponseMessages>
</m:GetStreamingEventsResponse>
</soap11:Body>
</Envelope>
</Trace>
Ok I ran into this error that I finally managed to track down. Basically it's a bit of a misleading error from Exchange.
The actual error (at least in my case) was that the number of pull subscriptions for the service account we were using to connect to exchange had been reached. Microsoft's documentation on throttling. Basically per account 20 open subscriptions. It seems when you reach this limit, the subscription will still be created, but either gets created somehow under a different user, or it is immediately killed. Exchange then returns that ErrorSubscriptionAccessDenied error.
The solution that fixes the issue seems to be to use the service account and set the ImpersonatedUserId on the ExchangeService to the user that you are actually subscribing to. That way the subscription count goes against the individual user instead. We also had to set the ExchangeService to have an X-AnchorMailbox header with the impersonated user's SMTP address.
Hopefully this helps someone else from going insane.

Exchange EWS ID conversion

I am trying to build an EWS (via SOAP - it's a PHP app, no .net!) application that looks up the appointments of an arbitrary user and then looks up, if possible, the appointment details.
I use the GetUserAvailability call and get CalendarEvents back from it. So far so good, for events where I have view permission in Outlook too I get a CalendarEventDetails block inside the CalendarEvent. The ID however is nothing I can use in a subsequent GetItem call:
ID from CalendarEventDetails: 00000000D18EFE3E27D8FA498176E18417AF9E590700B2A9C65B63B7D74B9028423C9EEB4F6800000000010D0000B2A9C65B63B7D74B9028423C9EEB4F6800008765890B0000
ID from the CalendarItem retrieved by a FindItem call (on the Calendar folder of the target user): AAMkAGM5ODcxMzhjLTRkMGYtNDVmNC1iOTc5LTMyNWIyZTJhNWVjZABGAAAAAADRjv4+J9j6SYF24YQXr55ZBwCyqcZbY7fXS5AoQjye609oAAAAAAENAACyqcZbY7fXS5AoQjye609oAACHZYkLAAA=
When I base64-decrypt the FindItem ID and convert it to hex, the FindItem id seems to consist of some header, a UUID and the ID from CalendarEventDetails.
What do I need to do to use a CalendarEventDetails ID with a GetItem call?
00000000D18EFE3E27D8FA498176E18417AF9E590700B2A9C65B63B7D74B9028423C9EEB4F6800000000010D0000B2A9C65B63B7D74B9028423C9EEB4F6800008765890B0000
This Id is the HexEntryId of the calendar appointment so it needs to be converted to an EWSId using the ConvertId operation in EWS https://msdn.microsoft.com/en-us/library/office/bb799665(v=exchg.150).aspx . You will need to convert from Type HexEntryId to EWSid eg
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010_SP2" />
</soap:Header>
<soap:Body>
<m:ConvertId DestinationFormat="EwsId">
<m:SourceIds>
<t:AlternateId Format="HexEntryId" Id="00000000D18EFE3E27D8FA498176E18417AF9E590700B2A9C65B63B7D74B9028423C9EEB4F6800000000010D0000B2A9C65B63B7D74B9028423C9EEB4F6800008765890B0000" Mailbox="user#domain.com" />
</m:SourceIds>
</m:ConvertId>
</soap:Body>
</soap:Envelope>

Is there a way to Output 'Extent Report Results' to a Unique Directory?

Is there a way to Output 'Extent Report Results' to a Unique Directory?
For example lets say i execute the my Cucumber framework for the first time > a output folder will be created with the relevant html report as listed:
But is there a way to output a unique folder of the unique report captured at the time of execution, something in the lines of:
I have the following Extent config:
<?xml version="1.0" encoding="UTF-8"?>
<extentreports>
<configuration>
<encoding>UTF-8</encoding>
<documentTitle>Cucumber Extent Reports - v3.0.5</documentTitle>
<reportName>Automation Framework Cucumber Report</reportName>
<reportHeadline> - v3.0.5</reportHeadline>
</configuration>
</extentreports>
Use the appropriate constructor of ExtentHtmlReporter...
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(OUTPUT_FOLDER + FILE_NAME);
Set up folder name to whatever you desire.

QuickBooks SDK "ticket parameter is invalid" error

We have an order import app that has been in production for 3 months. 2 weeks ago we started getting intermittent "invalid ticket parameter" exceptions. What does this mean and how can we fix it?
We get it on various requests: customer and item queries, sales order inserts, etc. Most of the time these calls work fine but every so often one of them will kick out an exception. Here's an example from our log:
2014/03/20 13:11:28.222 - Error in QB.ExecuteRequests(IMsgSetRequest): Exception: The ticket parameter is invalid.
2014/03/20 13:11:28.222 - Error in QB.ExecuteRequests(IMsgSetRequest): RequestXML:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="12.0"?>
<QBXML>
<QBXMLMsgsRq onError = "continueOnError">
<ItemQueryRq requestID = "0">
<NameFilter>
<MatchCriterion>Contains</MatchCriterion>
<Name>01507</Name>
</NameFilter>
<OwnerID>0</OwnerID>
</ItemQueryRq>
</QBXMLMsgsRq>
</QBXML>
Any ideas? QBSDK v12 with QBES 2013.
Enable verbose logging and see if the logs tell you anything. https://intuitpartnerplatform.lc.intuit.com/questions/177198-troubleshooting-sdk-issues

Exchange EWS - How to retrieve occurrence from master event on specific date?

I want to retrieve the occurrence (ItemID) from a recurring master calendar event on a specific date (I have the date of the occurrence and the recurring master event data).
I was trying FindItem with a restriction like this
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2007_SP1"/>
</soapenv:Header>
<soapenv:Body>
<mes:FindItem Traversal="Shallow">
<mes:ItemShape>
<typ:BaseShape>AllProperties</typ:BaseShape>
</mes:ItemShape>
<mes:Restriction>
<typ:IsEqualTo>
<typ:FieldURI FieldURI="item:RecurringMasterItemId"/>
<typ:FieldURIOrConstant>
<typ:Constant Value="AQMkAD[snip]AAAAA=="/>
</typ:FieldURIOrConstant>
</typ:IsEqualTo>
</mes:Restriction>
<mes:ParentFolderIds>
<typ:DistinguishedFolderId Id="calendar"/>
</mes:ParentFolderIds>
</mes:FindItem>
</soapenv:Body>
</soapenv:Envelope>
but this returns:
The 'FieldURI' attribute is invalid - The value 'item:RecurringMasterItemId' is invalid according to its datatype (types:UnindexedFieldURIType) - The Enumeration constraint failed.
(I also know the ChangeKey for the recurring appointment and tried that, with the same error)
How should this be fixed to make it work?
BTW. I know about retrieving occurrences with GetItem like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
<typ:RequestServerVersion Version="Exchange2007_SP1"/>
</soapenv:Header>
<soapenv:Body>
<mes:GetItem>
<mes:ItemShape>
<typ:BaseShape>IdOnly</typ:BaseShape>
</mes:ItemShape>
<mes:ItemIds>
<typ:OccurrenceItemId RecurringMasterId="AQMkAD[snip]AAAA==" InstanceIndex="1"/>
<typ:OccurrenceItemId RecurringMasterId="AQMkAD[snip]AAAA==" InstanceIndex="2"/>
<typ:OccurrenceItemId RecurringMasterId="AQMkAD[snip]AAAA==" InstanceIndex="3"/>
</mes:ItemIds>
</mes:GetItem>
</soapenv:Body>
</soapenv:Envelope>
Then, I could retrieve StartDate and loop through them, but there is no way I can predict the InstanceIndex range that might apply.
Thanks in advance,
Jan
It does not look like this is possible.
I have now resorted to using GetItem, retrieving 50 occurrences at a time.
This returns a list of GetItemResponseMessages containing either:
Succesful occurrence retrievals
ErrorCalendarOccurrenceIndexIsOutOfRecurrenceRange responsecode indicating that we have reached the last occurrence
Other 'real' errors
ErrorCalendarOccurrenceIsDeletedFromRecurrence responsecode indicating that the occurrence was deleted
So I just loop until I have found the proper date, reached ErrorCalendarOccurrenceIndexIsOutOfRecurrenceRange, or reached a maximum number of calls set in my code.