I want to retrieve customer devices including server attributes all at once to display the information in a table, without having to retrieve the list of the devices first and then retrieving the attributes afterwards for each device.
I don't know if it is possible to push server attributes to additionalInfo field that is included in the device response.
Following the Swagger documentation I have this option:
Actual Scenario:
1 call:
GET /api/customer/{customerId}/devices{type,textSearch,idOffset,textOffset,limit}
getCustomerDevices
N calls:
GET /api/plugins/telemetry/{entityType}/{entityId}/keys/attributes/{scope}
getAttributeKeysByScope
Desired Scenario:
1 call:
GET /api/customer/{customerId}/devices/attributes{type,textSearch,idOffset,textOffset,limit,scope}
getCustomerDevices
But it is not the best.
Device {
additionalInfo (string, optional),
createdTime (integer, optional),
customerId (CustomerId, optional),
id (DeviceId, optional),
name (string, optional),
tenantId (TenantId, optional),
type (string, optional),
attributes { # <<
client, # <<
shared, # <<
server. # <<
}
}
Related
My attempt:
var user = (await client.Users.Request()
.Select(x => new { x.Id, x.OtherMails, x.Identities })
.Filter($"otherMails/any(id:id eq 'zed#gmail.com') or identities/any(ids:ids/issuerassignedid eq 'zed#gmail.com')")
.GetAsync());
which fails with:
Complex query on property identities is not supported.
See also this:
https://graph.microsoft.com/v1.0/users?$filter=startswith(displayName,'mary') or
startswith(givenName,'mary') or startswith(surname,'mary') or startswith(mail,'mary') or
startswith(userPrincipalName,'mary')
Note that email / OtherEmail fields are not populated.
Update - revised query fails with same error message.
public async Task<User> GetUserByEmailAddress(string email)
{
IGraphServiceUsersCollectionPage users = await client.Users.Request()
.Select(x => new { x.Id, x.Mail, x.OtherMails, x.Identities })
.Filter($"mail eq '{email}' or otherMails/any(id:id eq '{email}') or identities/any(ids:ids/issuerassignedid eq '{email}' and ids/signintype eq 'emailAddress')")
.GetAsync();
if(users.Any())
return users[0];
return null;
}
Identities and OtherMails properties of user object support $filter as described here.
Also when filtering on Identities object, you must provide both issuer and issuerAssignedId - refer to this doc for details.
I am not aware of your requirement but using Identities as filtering for email might not the best choice because ids wont necessarily be emails. If you are fltering for email you can use mail and other mail property - https://graph.microsoft.com/beta/users?$filter=otherMails/any(id:id eq 'mary#xx.live') or mail eq 'mary#xx.live'
Per the ticket I raised with Microsoft: "the error message is clear. You cannot filter (due not being supported) by identities and some additional property."
So if you need to search by email you have to load your entire user table into memory.
I use this code, this is working done payment when I remove OrderId: "21071" this, but I want to use OrderId: "21071" this is "21071" my website order id that customer place order from my website.
ChargeRequest body = new ChargeRequest(AmountMoney: amount, IdempotencyKey: uuid, CardNonce: nonce, BillingAddress: address, ShippingAddress: address, BuyerEmailAddress: txtEmail.Text, ReferenceId: "Booking #:" + bookingid, Note: bookingid, OrderId: "21071");
ChargeResponse response = transactionsApi.Charge(LocationId, body);
I face this error
Error calling Charge: {"errors":[{"category":"INVALID_REQUEST_ERROR","code":"NOT_FOUND","detail":"Resource not found.","field":"order_id"}]}
My error occurs when I use Orderid without Orderid it works fine, but I want to use Orderid
It seems like you're using your own Order ID there, instead of creating an Order using the Orders API first, and then referencing that Order ID in your Transaction.
You can find an example of how to use the Square Orders API here: https://developer.squareup.com/docs/orders-api/cookbook/link-orders-and-catalog-item
I'm trying to use GraphQL in iOS with Apollo Client. I have the following mutation:
login(user: String!, password: String!): UserType
and the UserType looks like this:
id: ID
user: String!
password: String!
name: String
lastname: String
email: Email!
groups: [GroupType]
In iOS, I have configured aopllo client as the doc says and is working perfectly, but I don't know how to get access to every field in the response. When the login success I want to read the json I receive as response with the UserType fields, so, I'm doing this:
apolloClient.perform(mutation: loginMutation) {
resultsGQL, error in
...
}
My question is, how can I read every field from resultGQL which belongs to the UserType data defined in my grapql schema?
Regards
The question is not 100% clear, since it is missing some code your mutation: A GraphQL mutation has to return at least one value, which you have to define. Since i'm not sure about your method
login(user: String!, password: String!): UserType
i am giving you a simple example for updating an existing userProfile with a GraphQL mutation and then returning every field being defined in your schema for userType.
Let us assume you have a userType (and therefore know the corresponding userId) and you want to modify the email:
mutation updateUserProfile($id: ID!, $newEmail: String) {
updateUser(id: $id, email: $newEmail) {
id
user
password
name
lastName
email
}
}
As you can see, after executing
updateUser(id: $id, email: $newEmail)
all return values are defined inside the following {...} parentheses and are therefore accessible in your callback variable
resultsGQL
That means:
apolloClient.perform(mutation: loginMutation) { resultsGQL, error in
if let results = resultsGQL?.data {
// "results" can now access all data from userType
}
}
Since you defined all entities of your userType schema to be returned from the mutation, you can access them now in your callback variable.
I want to change some fields in user details that correspond to a certain e-mail id manually.
Currently I have to look in authentication console for the e-mail id corresponding to UID(which is basis of storing user details now) but I don't want to do that.
Another option I thought was storing user details on the basis of their mobile numbers(as it is equally easily recognisible as email-id), but this will make login system on the basis of phone number instead of email-id.
Main problem is dot in email-id's that don't let email-id's to store as keys.
It's true, Firebase does not allow in it's key symbols like . (dot). There are also other symbols like $ (dollar sign), [ (left square bracket), ] (right square bracket), # (hash or pound sign) and / (forward slash) that are also forbidden.
So in order to solve your problem, you need to encode the email address like this:
name#email.com -> name#email,com
To achieve this, i recomand you to use the following method:
static String encodeUserEmail(String userEmail) {
return userEmail.replace(".", ",");
}
And to decode the email, you can use the following method:
static String decodeUserEmail(String userEmail) {
return userEmail.replace(",", ".");
}
How to find an entry by property or predicate function in kvs? For example:
kvs:find(fun(X) -> X#user.name == "Alexander").
I can use this:
lists:filter(Predicate, kvs:all(entity)).
But I don't want to load all entries into memory.
I have found that kvs is key-value storage, so we have to search entry only by keys specified in the entity table schema:
-record(user, {
id,
userName,
password
}).
#table{name=user,fields=record_info(fields,user), keys = [userName]}
Then we can do this:
kvs:index(user, userName, "Alexander").