import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
ups: {
type: "app",
app: "ups",
}
},
async run({steps, $}) {
const data = {
"XAVRequest": {
"AddressKeyFormat": {
"ConsigneeName": "RITZ CAMERA CENTERS-1749",
"BuildingName": "Innoplex",
"AddressLine": [
"26601 ALISO CREEK ROAD",
"STE D",
"ALISO VIEJO TOWN CENTER"
],
"Region": "ROSWELL,GA,30076-1521",
"PoliticalDivision2": "ALISO VIEJO",
"PoliticalDivision1": "CA",
"PostcodePrimaryLow": "92656",
"PostcodeExtendedLow": "1521",
"Urbanization": "porto arundal",
"CountryCode": "US"
}
}
}
return await axios($, {
method: "post",
url: `https://onlinetools.ups.com/api/addressvalidation/v2/1`,
headers: {
Authorization: `Bearer ${this.ups.$auth.oauth_access_token}`,
"content-type": `application/json`,
},
params: {
maximumcandidatelistsize: `1`,
},
data,
})
},
})
Get tracking information for a UPS tracking number. See the documentation
UPS uses OAuth authentication. When you connect your UPS account, Pipedream will open a popup window where you can sign into UPS and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any UPS API.
Pipedream requests the following authorization scopes when you connect your account:
GEThttps://onlinetools.ups.com/security/v1/oauth/authorize?client_id={{custom_fields.client_id}}&redirect_uri={{oauth.redirect_uri}}&state={{oauth.state}}&response_type=codePOSThttps://onlinetools.ups.com/security/v1/oauth/tokencontent-type: application/x-www-form-urlencodedaccept: application/jsonredirect_uri={{oauth.redirect_uri}}&grant_type=authorization_code&code={{oauth.code}}POSThttps://onlinetools.ups.com/security/v1/oauth/refreshcontent-type: application/x-www-form-urlencodedaccept: application/jsongrant_type=refresh_token&refresh_token={{oauth.refresh_token}}