UPS Shipping REST API - api

I am wanting to make a dummy REST call using UPS's API to generate a test fake shipment request.
I am following the REST UPS documentation for the shipping package:
https://www.ups.com/upsdeveloperkit/downloadresource?loc=en_US
Page 116 shows an example of a client application creating a shipment and getting a successful response with a shipping label. I would like to re-create this so I have attempted to POST some fake data to the TEST URL address:
https://wwwcie.ups.com/ship/v1/shipments
I make the request (with header and body information), but I keep receiving error code 120100 (missing or invalid shipper number).
A lot of forums posts are saying it has something to do with my address not being setup on my UPS account, but I already have an address setup on my account, and I just want to make a fake request to the TEST URL endpoint.
Here is the body of request:
{
"ShipmentRequest":{
"Shipment":{ "Description":"1206 PTR", "Shipper":{
"Name":"ShipperName", "AttentionName":"AttentionName", "TaxIdentificationNumber":"TaxID", "Phone":{
"Number":"1234567890" },
"ShipperNumber":"ShipperNumber", "Address":{
"AddressLine":"AddressLine", "City":"City", "StateProvinceCode":"STD", "PostalCode":"PostalCode", "CountryCode":"EN"
} },
"ShipTo":{
"Name":"ShipToName", "AttentionName":"AttentionName", "Phone":{
"Number":"1234567890" },
"FaxNumber":"1234567999", "TaxIdentificationNumber":"456999", "Address":{
"AddressLine":"AddressLine", "City":"City", "StateProvinceCode":"STD", "PostalCode":"PostalCode", "CountryCode":"EN"
} },
"ShipFrom":{ "Name":"ShipperName", "AttentionName":"AttentionName", "Phone":{
"Number":"1234567890" },
"FaxNumber":"1234567999", "TaxIdentificationNumber":"456999", "Address":{
"AddressLine":"AddressLine", "City":"City",
"StateProvinceCode":"STD", "PostalCode":"PsotalCode", "CountryCode":"EN"
} },
"PaymentInformation":{ "ShipmentCharge":{
"Type":"01", "BillShipper":{
"AccountNumber":"AccountNumber" }
} },
"Service":{
"Code":"01", "Description":"Expedited"
},
"Package":[{ "Description":"International Goods", "Packaging":{
"Code":"02" },
"PackageWeight":{ "UnitOfMeasurement":{
"Code":"LBS" },
"Weight":"10" },
"PackageServiceOptions":"" },
{
"Description":"International Goods", "Packaging":{
"Code":"02" },
"PackageWeight":{ "UnitOfMeasurement":{
"Code":"LBS" },
"Weight":"20" },
"PackageServiceOptions":"" }]
, "ItemizedChargesRequestedIndicator":"", "RatingMethodRequestedIndicator":"", "TaxInformationIndicator":"", "ShipmentRatingOptions":{
"NegotiatedRatesIndicator":"" }
}, "LabelSpecification":{
"LabelImageFormat":{ "Code":"GIF"
} }
} }

I resolved this issue by finding the Shipper Number (Account Number) linked to the UPS developer account.

Related

Attempting to subscribe to a Shopify Webhook w/AWS EventBridge produces error: "Address is an AWS ARN and includes api_client_id 'x' instead of 'y'"

I'm running this request through Postman. Some posts to the Shopify developer forum (e.g., this one) express without clear explanation that the request should be made within the Shopify app that would be subscribing to the Webhooks, but Postman seems to work, too.
In Postman . . .
Here's the endpoint:
https://{{shopifyDevelopmentStoreName}}.myshopify.com/admin/api/2022-07/graphql.json
Here's the GraphQL body:
mutation createWebhookSubscription($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {
eventBridgeWebhookSubscriptionCreate(
topic: $topic,
webhookSubscription: $webhookSubscription
) {
webhookSubscription {
id
}
userErrors {
message
}
}
}
Here's the payload being sent (notice the "client_id_x" value within the arn property):
{
"topic": "PRODUCTS_CREATE",
"webhookSubscription": {
"arn": "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/client_id_x/LovecraftEventBridgeSource",
"format": "JSON",
"includeFields": "id"
}
}
Here's the response I receive:
{
"data": {
"eventBridgeWebhookSubscriptionCreate": {
"webhookSubscription": null,
"userErrors": [
{
"message": "Address is invalid"
},
{
"message": "Address is an AWS ARN and includes api_client_id 'client_id_x' instead of 'client_id_y'"
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 990,
"restoreRate": 50.0
}
}
}
}
What's entirely unclear is why Shopify is insisting upon validity of "client_id_y" when, in AWS, the value being displayed is undeniably 'client_id_x'. Extremely confusing. I don't even see what difference using the Shopify app would make except that it produces a client_id value that works counter to one's expectations and intuitions.
Does anyone know why the heck Shopify isn't just using the client_id value of the event bus created earlier in Amazon EventBridge?
Same happend to me and I was lucky to find a solution.
The error message is just missleading.
I replaced the API Access Token for the Shopify Rest API Request (X-Shopify-Access-Token)
with the one from the Shopify App holding the aws credentials.
admin/settings/apps/development -> app -> API credentials -> Admin API access token. (can only be seen after creation)
Then I could subscribe webhooks to the app via the Rest Interface.

LinkedIn Share API creates a share but returns error 500

I'm asking this question on SO, since LinkedIn support is officially moved here.
I'm receiving HTTP 500 response from LinkedIn API endpoint while trying to create a share. This happens sporadically, but it is a quite often event last week or two. The weird part is that the share being created successfully.
Please advise. Could it be caused by spiking users activity on social media due to COVID19?
For the reference, here is request body POST-ed to https://api.linkedin.com/v2/shares (real ids are replaced).
{
"owner": "urn:li:organization:111111",
"text": {
"text": "Text text text"
},
"content": {
"contentEntities": [
{
"entity": "urn:li:digitalmediaAsset:111111"
}
],
"shareMediaCategory": "IMAGE"
},
"distribution": {
"linkedInDistributionTarget": {
"connectionsOnly": false,
"visibleToGuest": true
}
}
}
Response:
{
"message": "Internal Server Error",
"status": 500
}

Square REST API: Error issuing refund

Every time I try to refund a card, I get the JSON pasted below. This happens after I authorize a card, then capture the charge, then want to issue a partial refund. For “tender_id” I have tried both the transaction ID and the ID I am handed during the authorization. Of course for the capture there is no tender_id or id because a successful capture returns just “{}”.
I am also using sandbox credentials. The charge was done with a nonce generated with sandbox credentials as well.
What’s wrong?
Thanks...
POST to:
https://connect.squareup.com/v2/locations/CBASEHHNorL75TjuSOAvKQLnuNYgAQ/transactions/a2905f34-c8e8-5534-7676-82e8c580e9bf/refund
With this JSON:
{
"idempotency_key":"6464dc19-1703-47c0-81f9-4f0f1361eada",
"tender_id":"291d56b3-1e73-5bff-6e8e-719fd134b83f",
"reason":”Partial refund",
"amount_money":{
"amount":4500,
"currency":"USD"
}
}
Gives this reply:
{
"errors": [
{
"category": "INVALID_REQUEST_ERROR",
"code": "NOT_FOUND",
"detail": "Location `CBASEHHNorL75TjuSOAvKQLnuNYgAQ` does not have a transaction tender with ID `291d56b3-1e73-5bff-6e8e-719fd134b83f`."
}
]
}
UPDATE: The result from the requested GET call (in the comments to the answer) is:
{
"transaction":{
"id":"a2905f34-c8e8-5534-7676-82e8c580e9bf",
"location_id":"CBASEHHNorL75TjuSOAvKQLnuNYgAQ",
"created_at":"2017-02-21T22:08:10Z",
"tenders":[
{
"id":"a18b98c7-5ac7-51c1-618c-3b95ee124c1b",
"location_id":"CBASEHHNorL75TjuSOAvKQLnuNYgAQ",
"transaction_id":"a2905f34-c8e8-5534-7676-82e8c580e9bf",
"created_at":"2017-02-21T22:08:10Z",
"note":"Online Transaction",
"amount_money":{
"amount":12500,
"currency":"USD"
},
"processing_fee_money":{
"amount":372,
"currency":"USD"
},
"type":"CARD",
"card_details":{
"status":"CAPTURED",
"card":{
"card_brand":"VISA",
"last_4":"5858"
},
"entry_method":"KEYED"
}
}
],
"reference_id":"63614ae8-539a-4339-b5c7-554bae64fbed",
"product":"EXTERNAL_API"
}
}
After you capture, have you tried listing/retrieving the transaction to get the full details, including tender ids? Could you post your response from GET /v2/locations/CBASEHHNorL75TjuSOAvKQLnuNYgAQ/transactions/a2905f34-c8e8-5534-7676-82e8c580e9bf if that doesn't work?

Bank Payments via PayPal REST API

I am attempting to use the PayPal REST API to process a bank transaction using the a bank account and routing number.
Here is the ref for the api that I am using for testing: https://api.sandbox.paypal.com/v1/payments/payment
Here is my JSON:
{
"intent":"sale",
"payer":{
"payment_method":"bank",
"funding_instruments":[
{
"bank_account":{
"account_number":"01234567890123456",
"account_number_type":"BBAN",
"routing_number":"012345678",
"account_type":"Checking",
"account_name":"Test Account",
"auth_type":"WEB",
"first_name":"John",
"last_name":"Doe",
"birth_date":"1970-01-01",
"billing_address":{
"line1":"Somewhere Street",
"line2":"Suite 200",
"city":"Atlanta",
"country_code":"US",
"postal_code":"30350",
"state":"GA"
}
}
}
]
},
"transactions":[
{
"amount":{
"currency":"USD",
"total":"100"
}
}
]
}
Here is the response from the call:
"{\"name\":\"NOT_IMPLEMENTED\",\"message\":\"NOT_IMPLEMENTED\",\"information_link\":\"https://developer.paypal.com/webapps/developer/docs/api/#NOT_IMPLEMENTED\",\"debug_id\":\"53fd10d0a05c\"}"
Any guidance would be much appreciated.
It doesn't appear that "bank_account" is a valid option for funding_instruments. The docs only lists "credit_card" and "credit_card_token"
https://developer.paypal.com/docs/api/#fundinginstrument-object

Instagram API getting error on UTF-8 characters (tested on /tags/{TAGNAME}/media/recent)

Shamelessly stolen from this ( https://groups.google.com/forum/#!topic/instagram-api-developers/tRfU444ZyhU ) thread as I have the exact same issue and hoping for better responses here.
Long story short, a few hours ago this was working, now it isn't.
The test platform can be found at both from my website and https://apigee.com/console/instagram
Sending https://api.instagram.com/v1/tags/türkiye/media/recent (careful with the "ü")
result: {
"meta": {
"error_type": "OAuthParameterException",
"code": 400,
"error_message": ""client_id" or "access_token" URL parameter missing. This OAuth request requires either a "client_id" or "access_token" URL parameter."
}
}
Sending https://api.instagram.com/v1/tags/turkiye/media/recent (now with "u")
result: {
"pagination": {},
"meta": {},
"data": [
{},
{},
{},
{},.. .. .. ... and so on
Sending https://api.instagram.com/v1/tags/türkiye/media/recent?client_id=7176aa6ef2fd47fd9cb373a5354bd30f ("ü" again and this time manually attached client_id)
result: {
"meta": {
"code": 200
},
"data": {
"media_count": 1471127,
"name": "t"
}
}
This time I'm getting the name as "t". It seems the query is broken just before the "ü" letter which is UTF-8 (Turkish if needed).
This is a bug on Instagram-side. There's an open discussion on Instagram Developers Google group. Although, from what I've seen in my application, the bug now resolve.