How to get all the available shipping types with their charge using UPS API - ups

I am trying to integrate UPS API using XML to pull all the available shipping types with their shipping charge for a given shipping address. I am using this XML and it works fine for a given shipping type, I want to get all the available shipping type. Can anyone help me with the correct xml to use?
$data ="<?xml version=\"1.0\"?>
<AccessRequest xml:lang=\"en-US\">
<AccessLicenseNumber>$this->AccessLicenseNumber</AccessLicenseNumber>
<UserId>$this->UserID</UserId>
<Password>$this->Password</Password>
</AccessRequest>
<?xml version=\"1.0\"?>
<RatingServiceSelectionRequest xml:lang=\"en-US\">
<Request>
<TransactionReference>
<CustomerContext>Bare Bones Rate Request</CustomerContext>
<XpciVersion>1.0001</XpciVersion>
</TransactionReference>
<RequestAction>Rate</RequestAction>
<RequestOption>Rate</RequestOption>
</Request>
<PickupType>
<Code>01</Code>
</PickupType>
<Shipment>
<Shipper>
<Address>
<PostalCode>ZIP</PostalCode>
<CountryCode>US</CountryCode>
<AddressLine1>ADDRESS1</AddressLine1>
<City>CITY</City>
<StateProvinceCode>STATE</StateProvinceCode>
</Address>
<ShipperNumber>$this->shipperNumber</ShipperNumber>
</Shipper>
<ShipTo>
<Address>
<PostalCode>$dest_zip</PostalCode>
<CountryCode>US</CountryCode>
<AddressLine1>$dest_addr</AddressLine1>
<City>$dest_city</City>
<StateProvinceCode>$dest_state</StateProvinceCode>
</Address>
</ShipTo>
<ShipFrom>
<Address>
<PostalCode>$this->sourceZip</PostalCode>
<CountryCode>US</CountryCode>
</Address>
</ShipFrom>
<Service>
<Code>$service</Code>
</Service>
<Package>
<PackagingType>
<Code>02</Code>
</PackagingType>
<Dimensions>
<UnitOfMeasurement>
<Code>$this->dimensionsUnits</Code>
</UnitOfMeasurement>
<Length>$length</Length>
<Width>$width</Width>
<Height>$height</Height>
</Dimensions>
<PackageWeight>
<UnitOfMeasurement>
<Code>$this->weightUnits</Code>
</UnitOfMeasurement>
<Weight>$weight</Weight>
</PackageWeight>
</Package>
</Shipment>
</RatingServiceSelectionRequest>";
Thanks!

I got the answer to this, in case someone else wants to know.
We just need to change this portion in the XML
<RequestOption>Rate</RequestOption>
to
<RequestOption>Shop</RequestOption>
And it gives us rate for all the available shipping types.

Related

How to find GP Name from GP English Name in ADMX file

hi i am currently moving gpo's to intune. i have read all of microsoft's documentation but one thing they do not cover is how to derive the gp name (in admx file) from the gp english name (what you would see in gp edit console). For non custom ADMX they say you can use the csp console like the image below:
but i am wanting to move over gpos that use custom admx, such as google chrome. I can go into the gp edit console and see the "Action on startup" gpo for example in the following location: Google/Google Chrome - Default Settings (users can override)/Startup, Home page and New Tab page
but how do i associate that with a policy entry in the chrome.admx file? just by going through the file i see this entry that most closely resembles what I want to do but how can i be sure it is the right one?
<policy class="Both" displayName="$(string.RestoreOnStartup)" explainText="$(string.RestoreOnStartup_Explain)" key="Software\Policies\Google\Chrome" name="RestoreOnStartup" presentation="$(presentation.RestoreOnStartup)">
<parentCategory ref="Startup"/>
<supportedOn ref="SUPPORTED_WIN7"/>
<elements>
<enum id="RestoreOnStartup" valueName="RestoreOnStartup">
<item displayName="$(string.RestoreOnStartup_RestoreOnStartupIsNewTabPage)">
<value>
<decimal value="5"/>
</value>
</item>
<item displayName="$(string.RestoreOnStartup_RestoreOnStartupIsLastSession)">
<value>
<decimal value="1"/>
</value>
</item>
<item displayName="$(string.RestoreOnStartup_RestoreOnStartupIsURLs)">
<value>
<decimal value="4"/>
</value>
</item>
</enum>
</elements>
</policy>
If you download the chrome policy templates zip, go to windows\admx\en-us folder. There’s a chrome.adml that will contain all the string substitutions for the admx. Admx + locale adml = what you see in the Gp editor window.

Get the release date of an album last.fm api

I need to get the release date of a song.
In last.fm API, like described on the documentation, is enough to make an HTTP request to the server and it will reply with an XML (or JSON) that contain the field "" (like is shown in the Sample Response on the website).
The problem is that if I call with the same request in the documentation the reply is identical except the field that I need.
Is possible to get this information in another way?
Example:
portion of the sample response in the website:
<album>
<name>Believe</name>
<artist>Cher</artist>
<id>2026126</id>
<mbid>61bf0388-b8a9-48f4-81d1-7eb02706dfb0</mbid>
<url>http://www.last.fm/music/Cher/Believe</url>
<releasedate>6 Apr 1999, 00:00</releasedate> //i need this
<image size="small">...</image>
<image size="medium">...</image>
<image size="large">...</image>
<listeners>47602</listeners>
<playcount>212991</playcount>
<toptags>
<tag>
<name>pop</name>
<url>http://www.last.fm/tag/pop</url>
</tag>
...
</toptags>
<tracks>
<track rank="1">
<name>Believe</name>
<duration>239</duration>
<mbid/>
<url>http://www.last.fm/music/Cher/_/Believe</url>
<streamable fulltrack="0">1</streamable>
<artist>
<name>Cher</name>
<mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid>
<url>http://www.last.fm/music/Cher</url>
</artist>
</track>
...
</tracks>
</album>
my Response
<album>
<name>Believe</name>
<artist>Cher</artist>
<mbid>63b3a8ca-26f2-4e2b-b867-647a6ec2bebd</mbid>
<url>https://www.last.fm/music/Cher/Believe</url>
<image size="small">
https://lastfm.freetls.fastly.net/i/u/34s/3b54885952161aaea4ce2965b2db1638.png
</image>
<image size="medium">
https://lastfm.freetls.fastly.net/i/u/64s/3b54885952161aaea4ce2965b2db1638.png
</image>
<image size="large">
https://lastfm.freetls.fastly.net/i/u/174s/3b54885952161aaea4ce2965b2db1638.png
</image>
<image size="extralarge">
https://lastfm.freetls.fastly.net/i/u/300x300/3b54885952161aaea4ce2965b2db1638.png
</image>
<image size="mega">
https://lastfm.freetls.fastly.net/i/u/300x300/3b54885952161aaea4ce2965b2db1638.png
</image>
<image size="">
https://lastfm.freetls.fastly.net/i/u/300x300/3b54885952161aaea4ce2965b2db1638.png
</image>
<listeners>405536</listeners>
<playcount>2644726</playcount>
<tracks>
...
<tags>...</tags>
<wiki>...</wiki>
</album>
</lfm>
The request is http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=MY_API_KEY&artist=Cher&album=Believe
The page where that informations are is: https://www.last.fm/api/show/album.getInfo
Thanks a lot!
Definitely an inconsistency in the Last.fm API documentation vs the actual response.
The only other place where such an info might be available is the artist.getTopAlbums, but the release date is not available there either.
So, to answer your question, no, it is not possible to get the release date of the album via the API. Your best bet, if you really want this piece of information, is to extract it from the html page itself via web-scraping, and to not rely on the API for this scenario.
I'm having the same issue - the release date doesn't come back. I've opted to use the MusicBrainz API to get the album details. However the issue with that is the calls will come back as 500s if too many requests are made in quick succession - the only workaround that I can find is to put a second delay on each call, which becomes annoying with a lot of albums.
Anyway, here's a sample request : http://musicbrainz.org/ws/2/release/844eb096-2b84-4c8f-9922-7f287126b39e?fmt=json
If you find a workaround for the timing issue let me know

Can't use EWS UpdateItem operation from Outlook add-in

I'm am trying to update a dictionary element in the IPM.Configuration.OWA.UserOptions message using an UpdateItem via an EWS (SOAP) request from an Outlook web add-in with ReadWriteMailbox permissions. However it is failing with the following error in the response:
ErrorAccessDenied: Office extension is not allowed to update this type of item.
The UpdateItem request I'm using is a fairly straightforward example of updating a message by it's ID and setting the value of an extended property:
<?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:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<RequestServerVersion Version="Exchange2013" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" soap:mustUnderstand="0" />
</soap:Header>
<soap:Body>
<m:UpdateItem MessageDisposition="SaveOnly" ConflictResolution="AlwaysOverwrite">
<m:ItemChanges>
<t:ItemChange>
<t:ItemId Id="AAMkAGM0YTZmNjhiLTI0OWYtNGFlNC05ODAzLTNlZWQyODhmOTY2MABGAAAAAACxU7lpjO+oS5hB0UfA6muFBwDcAGmTk49MRrSCdR7rvVFPAAAAAAEBAADcAGmTk49MRrSCdR7rvVFPAAD2pXuVAAA=" ChangeKey="CQAAABYAAADcAGmTk49MRrSCdR7rvVFPAAD2uhNb" />
<t:Updates>
<t:SetItemField>
<t:ExtendedFieldURI PropertyTag="0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UpdateItem>
</soap:Body>
</soap:Envelope>
The 0x7c07 property I'm updating in the UserOptions message contains a base64 encoded value of various signature related dictionary properties that I've modified:
<?xml version="1.0" encoding="utf-8"?>
<UserConfiguration>
<Info version="Exchange.12" />
<Data>
<e k="18-IsFocusedInboxOnLastUpdateTime" v="18-01/01/0001 00:00:00" />
<e k="18-autoaddsignature" v="3-True" />
<e k="18-UserOptionsMigrationState" v="9-5" />
<e k="18-themeStorageId" v="18-" />
<e k="18-autoaddsignatureonreply" v="3-True" />
<e k="18-timezone" v="18-Central Standard Time" />
<e k="18-signaturetext" v="18-
--
Izzz am Janick
" />
<e k="18-FavoriteFolders" v="1-18-3-120-AAMkAGM0YTZmNjhiLTI0OWYtNGFlNC05ODAzLTNlZWQyODhmOTY2MAAuAAAAAACxU7lpjO+oS5hB0UfA6muFAQDcAGmTk49MRrSCdR7rvVFPAAAAAAEMAAA=-120-AAMkAGM0YTZmNjhiLTI0OWYtNGFlNC05ODAzLTNlZWQyODhmOTY2MAAuAAAAAACxU7lpjO+oS5hB0UfA6muFAQDcAGmTk49MRrSCdR7rvVFPAAAAAAEJAAA=-120-AAMkAGM0YTZmNjhiLTI0OWYtNGFlNC05ODAzLTNlZWQyODhmOTY2MAAuAAAAAACxU7lpjO+oS5hB0UfA6muFAQDcAGmTk49MRrSCdR7rvVFPAAAAAAEPAAA=" />
<e k="18-IsOptimizedForAccessibility" v="3-False" />
<e k="18-IsFocusedInboxEnabled" v="3-True" />
<e k="18-NewEnabledPonts" v="9-2147401727" />
<e k="18-signaturehtml" v="18-<html><head></head><body><p>&nbsp;</p><p>--</p><p>John Doe</p><p>&nbsp;</p></body></html>;" />
</Data>
</UserConfiguration>
I can't find any documentation that states what is allowed or not allowed with UpdateItem operations (the list should be here). Updating the Outlook Online signature is also not currently possible with Graph or the Mail API. If what I'm trying to do ultimately cannot work then I just wasted 40+ hours of effort and will lose a client. :-|
Does anybody have any clever workarounds or know of a way to enable this operation? Note that using the EWS Managed API in server-side code is not currently an option for this solution.
Outlook does not allow add-ins to create or update FAI messages by design. In general we don't allow modifications of OWA options (or any other “service-type”, internal, item/data) directly which is probably an internal data structure, subject to change and potentially break the add-in.
If your scenario specifically requires access to outlook's signature system, I would recommend making a request to UserVoice

quickbooks online recievepaymentadd

i am trying to add a payment to quickbooks online from my web app. This is the xml that i am sending:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="6.0"?>
<QBXML>
<SignonMsgsRq>
<SignonTicketRq>
<ClientDateTime>2013-05-09T01:37:58</ClientDateTime>
<SessionTicket>V1-115-Q04ffswegvh9uzxaw8qrud:689712285</SessionTicket>
<Language>English</Language>
<AppID>688664435</AppID>
<AppVer>1</AppVer>
</SignonTicketRq>
</SignonMsgsRq>
<QBXMLMsgsRq onError="stopOnError">
<ReceivePaymentAddRq>
<ReceivePaymentAdd defMacro="MACROTYPE"> <!-- required -->
<CustomerRef> <!-- required -->
<ListID >5</ListID> <!-- optional -->
</CustomerRef>
<ARAccountRef>
<FullName>Accounts Receivable:Customer Receivables</FullName>
</ARAccountRef>
<AppliedToTxnAdd> <!-- optional, may repeat -->
<TxnID useMacro="MACROTYPE" >143</TxnID> <!-- required -->
</AppliedToTxnAdd>
<TxnDate >2013-05-09</TxnDate>
<RefNumber >123</RefNumber>
</ReceivePaymentAdd>
</ReceivePaymentAddRq>
</QBXMLMsgsRq>
</QBXML>
I get an error saying:
SAX parser encountered an error parsing request file.
Exception from other package:
org.xml.sax.SAXParseException: The content of element type "ReceivePaymentAdd" must match "(CustomerRef,ARAccountRef?,TxnDate?,RefNumber?,TotalAmount?,PaymentMethodRef?,Memo?,DepositToAccountRef?,CreditCardTxnInfo?,(IsAutoApply|AppliedToTxnAdd+)
I just need to apply a payment to an invoice. The payment will always be for the full amount of the invoice.
Any ideas what is wrong?
Thanks Randy
The order of tags in qbXML matters.
So if the Intuit OSR reference shows you that the correct order of tags is:
<CustomerRef>
<ListID>IDTYPE</ListID>
</CustomerRef>
<ARAccountRef>
<FullName>STRTYPE</FullName>
</ARAccountRef>
<TxnDate>DATETYPE</TxnDate>
<RefNumber>STRTYPE</RefNumber>
...
<AppliedToTxnAdd> ...
And you instead send tags in this order:
<CustomerRef>
<ListID >5</ListID>
</CustomerRef>
<ARAccountRef>
<FullName>Accounts Receivable:Customer Receivables</FullName>
</ARAccountRef>
<AppliedToTxnAdd>
<TxnID useMacro="MACROTYPE" >143</TxnID>
</AppliedToTxnAdd>
<TxnDate >2013-05-09</TxnDate>
<RefNumber >123</RefNumber>
Then you're going to get errors.
(notice you have TxnDate and RefNumber after the AppliedToTxnAdd tag, when the spec defines it as coming before the AppliedToTxnAdd tag)
What it's trying to tell you here:
The content of element type "ReceivePaymentAdd" must match
"(CustomerRef,ARAccountRef?,TxnDate?,RefNumber?,TotalAmount?,PaymentMethodRef?,Memo?,DepositToAccountRef?,CreditCardTxnInfo?,(IsAutoApply|AppliedToTxnAdd+)
Is that it's expecting tags in that order, and you sent them in a different order than it expected.
If you fix the order of the tags, it will work.
We have some example qbXML requests on our QuickBooks integration wiki guide if that helps.

Spring Security multiple filterChainProxy mapping/filters, custom filters Json Output

I have a part of my web application that is an RESTfull api and part a more standard web-pages.
I wish to have the REST part with some custom filters such as the EntryPoint, SuccessHandler and FailureHandler. This part is within the /rest/** mapping.
In the other hand, everything else needs to have more common filters and is mapped with /**.
The problem is to find an easy way to define the filterChainProxy with different mapping-filters.
Right now this solution doesn't work:
<!-- Normal web app -->
<http auto-config="true" use-expressions="true" authentication-manager-ref="authenticationManager">
<form-login/>
<logout/>
<intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
</http>
<!-- Configure RESTfull services -->
<http use-expressions="true" authentication-manager-ref="authenticationManager" entry-point-ref="restAuthenticationEntryPoint" >
<form-login authentication-success-handler-ref="restAuthenticationSuccessHandler" login-page="/rest/login" username-parameter="username" password-parameter="password" />
<logout logout-url="/rest/logout" />
<intercept-url pattern="/rest/**" method="GET" access="hasRole('ROLE_USER')" />
<intercept-url pattern="/rest/**" method="POST" access="hasRole('ROLE_ADMIN')" />
<intercept-url pattern="/rest/**" method="PUT" access="hasRole('ROLE_ADMIN')" />
<intercept-url pattern="/rest/**" method="DELETE" access="hasRole('ROLE_ADMIN')" />
</http>
It complains with: the univseral match being before other patterns.
Is there a way to define such a thing without resorting to define the filterChainProxy with the definition? The http version does help quite a lot to reduce the amount of configuration as I will have to manually set a UsernamePasswordAuthenticationFilter etc.
The next problem is more simple: I have to respond, after the form-login authentication with a JSON object.
So far, I have implemented a SuccessHandler (actually a version of the SimpleUrlAuthenticationSuccessHandler without the redirect part).
How do I write my JSON output?
I must have something like this:
HTTP 200 OK
with:
{"success":true,"customer {"email":"customer#email.com","session_id":"b83a41dfaca6785399f00837888886e646ff9088"}}
and a similar thing with the FailureHandler. It must be quite simple and it's surely is some very basic thing, but how do you do that? Redirecting to a custom controller is not a solution since I will have the 301 redirect status that a very simple REST client might not be able to understand.
At the very least, I wish to have only the http header and no body at all.
thanks!
If you can upgrade to Spring Security 3.1 it supports multiple chains using namespace configuration.