Amazon Seller Central API::GetOrders returning incorrect orders when called with OrderStatuses query parameter - amazon

We are using the following API call to get orders created in SC as unshipped orders.
https://sellingpartnerapi-na.amazon.com/orders/v0/orders?MarketplaceIds=ATVPDKIKX0DER&CreatedAfter=2021-01-01&OrderStatuses=Unshipped
Above one returns correct order data if there are no partially shipped orders. But, if there are partially shipped orders, the API call above includes that one as well. This is causing a problem while syncing the orders between SC and SAP.
The same thing is happening if we call the API with below url -
https://sellingpartnerapi-na.amazon.com/orders/v0/orders?MarketplaceIds=ATVPDKIKX0DER&CreatedAfter=2021-01-01&OrderStatuses=Partiallyshipped
is there a way to restrict the API call to return only either Unshipped or Partiallyshipped orders when called for a single Order status?
Github link - https://github.com/amzn/selling-partner-api-docs/blob/main/references/orders-api/ordersV0.md#orderstatus
Thanks
Sugata

Related

Dynamics Web API BATCH POST vs PATCH (remove navigation property value)

I am attempting to Disassociate a reference a contact reference to a single-valued navigation property by setting the value to null.
This works when I call the web api directly:
PATCH https://mydynamics.crm.dynamics.com/api/data/v9.2/contacts(00000000-0000-0000-0000-000000000000)
{ "firstname": "John",
"lastname":"Doe",
"lookup1#odata.bind": null,
"lookup2#odata.bind": null,
"lookup3#odata.bind": null
}
//[...other data omitted for brevity...]
So these lookup fields, lookup 1,2, and 3 would be reset to null (The association is removed).
We run a synchronization program that calls these operations in a batch and when this runs -- using the same payload -- the lookup fields fail to reset (although if I modified firstname or lastname - those fields would update). This is a POST batch call containing just the single PATCH operation in this case but it normally contains multiple operations.
All documentation I can find states that PATCH with multiple operation should be a POST call but it didn't reset my lookups.
If I change the POST batch to a PATCH batch...then it works as expected and all fields are updated correctly including the lookups!
Why the difference between BATCH POST vs PATCH?!
Is is a bug in the API?
Is it because I only had a single operation
in the batch? Would it work for multiple requests? (I didnt try).
Does using PATCH instead of POST have any negative affect on either a
single operation or multiple operations? Suppose a DELETE operation
was also in the batch for something? Microsoft says "Use a POST
request to submit a batch operation that contains multiple requests.
A batch request can include GET requests and change sets."
Why is the
documentation lacking on this topic?
Any help is appreciated!
Read your question while searching for related CRM WEB API challenges.
The response may be a bit overdue but here's what I think applies to your case:
POST, GET, PUT, PATCH, and DELETE are HTTP request types.
When using PATCH on MS CRM you can only edit a single record.
When you want to perform multiple operations at once you use a POST request to post a whole batch of different requests. This can include multiple PATCH requests.
How to POST a batch is described quite okay here:
https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/execute-batch-operations-using-web-api

REST API - execute multiple actions

Currently trying to work out how to use REST API to execute an action.
I added the ReverseInvoice action from Bills screen on my endpoints. And seems execute fine. Unfortunately, executing an action does not return a result e.g. 204 No Content. I'd wish to extract the RefNbr of the Debit Adj. raised.
Second problem is how do you stack actions or call series of actions ? The raised Debit Adj is not Released. So it seems ReverseInvoice & Release need to be executed at the same time. Plus, I also need them to be allocated against each other automatically.
I've got a feeling the REST API is not the way to go with this one.
Cheers and thanks for responses.
Unfortunately, you're correct on both points: Acumatica's Contract-based API (both SOAP and REST flavors) doesn't allow you to get the entity that is a result of an action (you can only get the status of action invocation), and if you want to chain a sequence of action you'll have to do that manually from the client (call one action, check for the status, call the second one, check, raise, rinse, repeat). Or you can write a customization with a custom action that call two actions in sequence, and call that from the API.

How can I use BQL to query data from another company context

I'm using a graph extension to post data to the Journal Transaction screen in another company context using the following:
using (PXLoginScope ls = new PXLoginScope(companylogin))
The problem is that I want to query Account from the target company in order to get the accountID using the accountCD of the source company. I've tried putting the BQL to select from Account under the PXLoginScope - but it doesn't seem to matter... it fetches records from the main company the graph extension is written in instead of the login scope of the other company. Is there a way to use BQL in one company to get records from another company?
By design, inside PXLoginScope the framework executes all BQL queries inside the context of the PXLoginScope company. It does not matter inside what company context a BLC instance was initialized. The actual company context comes into play only during the time BQL queries are executed.
With that said, there is no way to request data from multiple companies at the same time. The recommended approach is to pre-fetch all necessary data from the source company before your code enters PXLoginScope for the target company.
Since no one posted an answer to this, I'm assuming there's no way to do this within Acumatica.
My solution was to create a view that fetches records for all companies, with an accompanying DAC so that I can use BQL to query and filter based on company.

SeriesMaster not being returned when getting the CalendarView using the Office 365 API

The documentation (https://msdn.microsoft.com/en-us/office/office365/howto/sync-calendar-view) for getting a calendarview implies that the SeriesMaster event will be returned in the result, along with the individual occurrences and exceptions.
The documentation states (and shows by example):
Here's the information you need to know about how recurring events are handled for calendar view synchronization.
The service performs meeting expansion and sends the series master event and all of the event instances within the time window.
The series master event contains the recurrence pattern and the time window for the series.
The event instances contain their start and end time information as well as information about event occurrence exception.
However in actually using this endpoint, we're only receiving back the Occurrences/Exceptions and not the recurrence "master". The Occurences are full models, unlike slimmer models containing only the start/end like the documentation states.
It's important for us to be able to get sync SeriesMaster events along with the exceptions for the series (as is possible with GCal singleEvents=false) such that we can store this information and perform recurrence expansion on the client-side.
What am I doing wrong here?
Request (decoded for readability):
GET https://outlook.office365.com/api/v1.0/Users(...)/calendarview?$sort=startDateTime desc&$top=100&startDateTime=2016-01-01T22:12:34+0000&endDateTime=2016-03-10T23:12:34+0000
There is a similar issue when we try to get the CalendarView in EWS.
The Outlook calendar sync REST API works well as the description for me. Did the API works for you when you remove the $top query parameters?
Because the Outlook calendar sync REST API doesn't support $filter, $count, $select, $skip, $top, and $search query parameters.
Here is the link for the sync API for your reference:
https://msdn.microsoft.com/office/office365/api/calendar-rest-operations#Syncevents
Here is the response from calendar sync for your reference:

Fetch transactions from Stripe::Transfer with latest stripe version

I am using stripe latest version in production.
When I try to fetch transactions:
Stripe::Transfer.all.first.transactions
I fount, there is no transactions method for latest Stripe::Transfer
undefined method `transactions' for #<Stripe::Transfer
Stripe API is upgrades:
2014-08-04
The transactions, summary, and other_transfers properties in automatic transfer responses have been removed in favor of the balance history endpoint (/v1/balance/history), which can be called with the transfer id (using the ?transfer= parameter) to filter transactions by transfer.
So How we fetch transactions from Stripe transfer ?
But its working fine with Stripe old version.
You have a couple of options depending on what you want. If you a certain level of detail for charges you can fetch all the charges associated with a transfer which will fetch only that:
var options = {};
stripe.transfers.listTransactions(id, options);
If, on the other hand, you would like something more akin to the old summary object then I would get the balances associated with the transfer:
var options = { transfer: id };
stripe.balance.listTransactions(options);
The balances returned will contain a variety of balance types - the first one refers to the actual transfer as a whole and can be ignored and the rest is a combo of charges, refunds, adjustments, etc including the fees for each.
In both the above cases id refers to the transfer ID. Note that you will need to loop through these to fetch all items - this can be done in a couple of ways as listed under Pagination. In the above cases, I check if the result contains the has_more: true field and, if so, loop through again using the starting_after: X addecd to the options object where X is the ID of the last charge/balance returned on previous call.

Resources