The operation getOrderMetrics returns 0 for all response parameters for Amazon Selling Partner API - amazon-mws

I am trying to make an API call to get order metrics from the amazon seller central page from Postman App. I have followed all the steps in the documentation. When making a request to the api to get order metrics, I m getting the response as
URL : /sales/v1/orderMetrics?marketplaceIds=ATVPDKIKX0DER&interval=2020-03-31T00:00:00Z--2021-05-01T00:00:00Z&granularity=Week&buyerType=All&firstDayOfWeek=monday&asin=B08DFGPTSK
{
"interval": "2020-03-30T00:00Z--2020-04-06T00:00Z",
"unitCount": 0,
"orderItemCount": 0,
"orderCount": 0,
"averageUnitPrice": {
"amount": 0,
"currencyCode": "USD"
},
"totalSales": {
"amount": 0,
"currencyCode": "USD"
}
}
I have tried with with different ASINs, Intervals, Granularities and Granularity Time Zones but, all it returns is zero. Please tell me if I m missing something.

Related

Return value in the response from addKey in Microsoft Graph REST API v1.0

When running a POST with addKey using the old Azure AD Graph API (v1.6),
https://graph.windows.net/tenant_id/applications/app_oid/addKey?api-version=1.6, I get a response body with a return value containing the keyId of the newly created keyCredential:
"statusCode": 200,
"body": {
"odata.metadata": "https://graph.windows.net/tenantid/$metadata#Collection(Microsoft.DirectoryServices.KeyCredential)",
"value": [
{
"customKeyIdentifier": "A053F5114BC7F7C07F700CF2C4ACE47BBFD82D23",
"endDate": "2022-06-08T14:34:03Z",
"keyId": "fbbaf346-168a-4c90-97ca-346bcd43988d",
"startDate": "2020-06-08T14:34:03Z",
"type": "AsymmetricX509Cert",
"usage": "Verify",
"value": null
}
]
},
When running a POST with addKey using the latest version of the Microsoft Graph API (Microsoft Graph REST API v1.0),
https://graph.microsoft.com/v1.0/applications/app_oid/addKey,
I get a response body without the return value containing the keyId of the newly created keyCredential (the new keyCredential is created and can be seen in the list of keyCredentials belonging to the application, in the Azure portal):
"statusCode": 200,
"body": {
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.keyCredential"
}
Is there a way to get a return value containing the keyId (like in the Azure AD Graph API v1.6 example above) in the response?
According to the Ms graph document, you get odata.context by using
POST https://graph.microsoft.com/v1.0/applications/{id}/addKey
and you can get the key Id of the key credential by using the below query.
https://graph.microsoft.com/v1.0/applications/id
Currently it is not possible to get the keyId in the returnvalue from addKey using Microsoft Graph REST API v1.0, according to MSFT. Uservoice can be raised.

Azure B2C Active Directory: Update one property on all User

In my current project I'm using Microsofts Azure B2C Actice Directory.
My plan is to update a speciffic property (testClaim) of every single user.
What I'm actually doing ist loading all the users in my AD and updating each of them in an foreach-loop.
var requestBody = new SetTestClaimRequest
{
ClaimName = "testClaim",
Value = "thisIsATestValue"
};
var client = new RestClient("myRes");
var request = new RestRequest(Method.PUT);
request.AddJsonBody(requestBody);
The problem I'm facing is, that the GraphApi begins to block my requests, after just a few, and just answering with the following error:
Error Calling the Graph API:
{
"odata.error": {
"code": "Request_ThrottledTemporarily",
"message": {
"lang": "en",
"value": "Your request is throttled temporarily. Please try after 150 seconds."
},
"requestId": "ccf8a936-490e-4c4a-87aa-125157b2e6dd",
"date": "2020-04-17T12:37:44"
}
}
Is there a way to avoid this without throttling my request?
In my opinion throttling isn't a choice cause it would take multiple hours to update the amount of users im dealing with.
No, there is no way to bypass throttling limits. It may take some hours to process at the accepted rate. Try 1000 ops per minute maximum. Make sure to implement back off logic if you get a HTTP 429.

How to retrieve ETag property of user photo in Azure via Microsoft Graph API?

Currently, calls to Microsoft Graph call to retrieve user photo metadata is missing the ETag property. Is there any way to add this to the response along with the width, height information that is currently returned? Here is a sample response.
{
"#odata.context": "https://graph.microsoft.com/beta/$metadata#users('<user-id>')/photo/$entity",
"#odata.mediaContentType": "image/Jpeg",
"width": 128,
"height": 128,
"id": "128X128"
}
Notice the ETag is not returned with the response.
While to the contrary, the Outlook REST API V2.0 does return this information in its response for its equivalent API call:
{
"#odata.context": "https://outlook.office.com/api/v2.0/$metadata#Me/photo/$entity",
"#odata.id": "https://outlook.office.com/api/v2.0/Users('ddfcd489-628b-7d04-b48b-20075df800e5#1717622f-1d94-c0d4-9d74-f907ad6677b4')/photo",
"#odata.mediaContentType": "image/jpeg",
"#odata.mediaEtag": "\"BA09D118\"",
"Id": "240X240",
"Width": 240,
"Height": 240
}
Can this functionality be added to Microsoft Graph so that subsequent checks for changes to user photos do not require retrieval of the entire binary image photo data but instead simply the metadata information with this vital ETag property?
UPDATE:
Apparently, the #odata.mediaEtag is returned with the https://graph.microsoft.com/v1.0/me/photos API, but I'm again mainly interested/wondering why it is NOT being returned with the Users API for a custom domain-based tenant user: https://graph.microsoft.com/beta/users/{user_id}/photo.
ANOTHER UPDATE:
Based on a reply below, I did some digging, and realized that my Azure tenants do not have Exchange/Outlook/Mail enabled for any of my users (by design). Is there different behavior for this API call when users are mail-enabled and when they are not? If so, should that not be clarified somewhere Microsoft? Or does the API need to be updated to include the mediaETag for all scenarios? Please advise.

good way for my database app RESTful hierarchy and push to array

I use firebase with ionic (angularJS) and its my first utilisation of firebase. Im thinking about my database hierarchy and I am i bit confused.
myapp {
"gyms": {
"0": {},
"1": {},
"2": {}
},
"users" : {
"0" : {},
"1": {},
"2": {}
},
"sessions" : {
"0" : {
"user_id": {
"session_id": {
"routes": {
"0": {
},
"1": {
},
"2": {
},
}
}
}
},
"1": {},
"2": {}
},
}
What i need with RESTful :
// GYMS
gyms/
GET all gym objects
POST : I put manually a new gym with id: 0, 1, 2 ...
gyms/:gym_id
GET the gym corresponding to the id
exemple : gyms/0
gyms/:gym_id/users
GET all users from a specific gym
// USERS
users/
GET all users
POST create a new user, i would have a user_id numeric like id 0, 1, 2...
users/:user_id
GET the user corresponding to the id
// SESSIONS
sessions/
GET all sessions objects
sessions/:user_id
GET all sessions from a specific user
POST create a new session for the user
sessions/:user_id/:session_id
GET a specific session from a specific user
sessions/:user_id/:session_id/routes
GET all routes from a specific session and user
POST create a new route for the session
sessions/:user_id/:session_id/routes/:route_id
GET a specific route from a specific session and user
for resume, gyms contains users who have sessions. Each sessions contains routes. Each user is associated to a gym, and each session is at a user. Each session contains some routes. First time i make a JSON database, so, it is good ?
I said higher i want id like 0, 1, 2 for having a RESTful url like sessions/12/4/routes/8. But i seen the article for array and push with uniqueID generated from firebase like "-JyNAzZHIoMEpBe39a55" but what is the function for pushing an object to an array and have a id like 0, 1, 2? Because url like sessions/JyNAzZHIoMEpBe39a55/JyNAzZHIoMEpBe39a57/routes/JyNAzZHIoMEpBe39a57 are less human readable no ?
sorry for my bad english !
Sequential indices may be more readable. Whether they are better, depends on your aims. Firebase was designed for highly scalable multi-user systems, where indices are likely to become a bottleneck as users are adding items to the database.
From the Firebase blog post on our push ids:
We created push IDs for collaborative, multi-user applications to handle situations where many clients are adding to a list at the same time. We needed IDs that could be generated client-side so that they wouldn’t need to wait for a round-trip to the server. And we needed them to be unique so that many clients could append data to the same location at the same time without worrying about conflicts.
You're free to come up with your own scheme of course, but this summarizes why Firebase recommends using push ids.

Google App Engine - Deployment not working

I have a Google App Engine project (an API) working against a Google Cloud SQL instance. I have a exact copy of both, the API and the SQL instance, running local.
When I execute the project on development (local), I can explore the API just fine. Yet, when I go on deployment, all the calls return empty.
This is the API code (Java):
#ApiMethod(
name = "test.users.list",
path = "test/users/list",
httpMethod = "get"
)
public UserList testUserList ()
{
UserList users = UserList.getAll();
return users;
}
This is what it returns local:
{
"users": [
{
"id": "3",
"firstName": "Test",
"lastName": "User",
"email": "test#test.com",
"password": "12fc892642c48a8227410f5b6722e1edeeefedfb",
"logins": 0,
"lastLogin": 0,
"roles": [
{
"id": "1",
"name": "user",
"loaded": true
}
],
"fullName": "Test User",
"admin": false,
"lastLoginDat": "1969-12-31T21:00:00.000-03:00",
"loaded": true
},
{
"id": "6",
"firstName": "Test",
"lastName": "User 2",
"email": "test2#test.com",
"password": "c5bc2a33ddffcfb3d61779ab44d7d933e1336b02",
"logins": 0,
"lastLogin": 0,
"fullName": "Test User 2",
"admin": false,
"lastLoginDat": "1969-12-31T21:00:00.000-03:00",
"loaded": true
}
]
}
This is what it returns on the server explorer:
{
"kind": "myapp#usersItem",
"etag": "\"l4AE0sdQvyB-SkumpjWQFJVUZzo/MSGC-asdfasdf\""
}
Some insight:
I have access (through MySQL Workbench) to the local SQL instance and the Google Cloud SQL external instance.
Both, local and external SQL instances, are equal to each other.
I've also guaranteed access to the project I'm using to hit the DB (trough the Google Cloud panel).
I don't really know what to do or check. I've searched for something similar but couldn't find anything related.
Any thought is appreciated.
As Jan pointed out, GAE local and production are two separate stories. But I'm gonna give you something even better than this particular solution, which is the tools to resolve this and further problems:
1. Go to Console > Compute > App Engine > Versions, and make sure the backend version you uploaded is the right one (take a look at the time it was uploaded) and is selected or default.
2. Create an API test method that does a rather basic operation against the DB, but without calling other methods nor using try/catch blocks. You're trying to raise a exception here, if any. All the code you need to hit the DB and return the data should be inside that method.
3. Go to the explorer panel, and execute your test method. If it works, then your problem is not in the connection, but in the logic. Use the same approach of (2) to test the logic.
4. If the method doesn't work, go to: Console > Monitoring > Logs. There you'll find the exception trace.

Resources