Is there a possibility to get 'Last Seen' parameter for all Users in Amplitude via the API? - amplitude-analytics

I tried to find solution in Amplitude's User Profile API, but it allows request this data for just one user at once, defining user_id.

Related

Facebook marketing API Does not select the correct pixel conversion event

I'v built an app that creates ads using the marketing API. When it creates the adset it sets a specific pixel and a page view event.
All our users get the correct pixel and the correct event except for one user.
Here is the object from the post request that is being sent to Facebook where we can see that they are equal
User one
"promoted_object":"{\"pixel_id\":xxxxxxxxxx63,\"custom_event_type\":\"CONTENT_VIEW\",\"pixel_rule\":\"{\\\"event\\\":{\\\"eq\\\":\\\"PageView\\\"}}\"
User two
"promoted_object":"{\"pixel_id\":xxxxxxxxxx63,\"custom_event_type\":\"CONTENT_VIEW\",\"pixel_rule\":\"{\\\"event\\\":{\\\"eq\\\":\\\"PageView\\\"}}\"
Both get the correct pixel with the correct id but one gets no conversion event, and say Missing conversion event.
Both ad accounts have full access to the pixel under the business settings in ads manager.
Here is an image that describes the issue.
Anyone have any ideas here?
make sure the conversion event is defined in that account.
The conversion event is usually set on Campaign Level and supplied when you create a campaign via API.
As you're trying to use a custom conversion it might be that you've created it for one account but didn't create it for another. That's why you don't see it in you campaign setup view. You can create it via API as described here:
Custom Conversion API
Or just do it via Business Manager and use it afterward when creating you campaigns via API or manually.
It's definitely not a request that fails in this case but a proper account configuration.

Bulk assignment of multiple users to an app in Okta through Postman API

I am trying to add some users to an application in Okta simultaneously through Postman API i.e. bulk assignment of multiple users to an app. Assigning them at a time will save my manual labour as well as time.
For example, suppose we have been given the email IDs of 10 users who all need to be assigned to an application (let's say VEEVA). Is there any effective way of doing this through Postman API?

REST Endpoints for Current User vs ID

As far as REST APIs go, which is the better structure to follow in general?
Assume GET/PUT/POST/DELETE for all resources.
1) Use currently signed in user for /users/**/* routes.
/users
/users/password
/users/email
/users/preferences
/users/documents
/documents/:id
2) Having absolute paths with IDs and using /users/:id for currently signed in user?
/users
/users/:id/password
/users/:id/email
/users/:id/preferences
/preferences/:id
Does it matter?
If the resource you are referring can be multiple, you should go with
/resource/resource_id
In the above case, user can only be the current person, so using a pattern like /users/user_id, sounds odd. Because, you will have to handle different cases like What if a logged in USER A triggers an api call with a different user-id USER B??
You can have a namespace like /profile for managing the email, name, image etc. You don't have to make it as /users/profile as it is implicit that the data is going to be manipulated / accessed for the current logged in user.
Both are fine. What's nice about creating unique endpoints for every user, is that one day you can allow user X to access information about user Y.
The pattern I followed in a recent API was to create a unique endpoint for every user, but 1 endpoint /current-user that redirects to the /user/:some-id.
A url might indicate an identity. It makes a lot of sense that other resources might refer to user as a 'creator' or 'modifier' of sommething, and in those places you might want to use a url (and not just a userId).

Get results for specific facebook marketing campaigns objectives

Each Facebook ad campaign has an objective, such as LINK_CLICKS or CONVERSIONS.
In Ad Manager, one can see the performance of each of their ad campaigns. There is a column called "results" that has the number of objective-specific conversions for that campaign. So for example, if the objective is PAGE_LIKES then results would show the number of page likes resulting from the campaign, but if the objective was LINK_CLICKS then results would show website clicks.
My question is: Is there something in the Insights API that equates to the results column in Ad Manager? Part of the reason I ask is for ease and consistency, but also some of the objectives are ambiguous, e.g. BRAND_AWARENESS.
No, I haven't been able to easily replicate the results and cost per result columns from the ad manager with an API call.
First you can check the URL when in the ad manager to see which columns are selected by looking at the GET parameter columns:
https://business.facebook.com/ads/manage/powereditor/manage/ads?act=...&business_id=..&columns=name%2Cerrors%2Cdelivery%2Cresults%2Creach%2Cimpressions%2Ccost_per_result&...
Decoding this gives the following fields:
columns=name,errors,delivery,results,reach,impressions,cost_per_result
Now it looks like we could simply use the result and cost_per_result fields, but that gives an error:
(#100) results, cost_per_result are not valid for fields param.
This is expected as the API document doesn't specify results and cost_per_result as valid fields.
Now when in the ad manager we can also see the API calls use the network tab of developer tools to see it making API calls to retrieve data. This shows us the result and cost_per_result fields being used. You can actually copy the request URl and see it working... somehow..
Trying to recreate this API call in the Graph API Explorer only worked for me when I copied the access token from the previous call. This makes me feel that the business manager has a special access token.

Realtime User friends updates: new friends

Unfortunately the facebook realtime api only informs about something has changed in the friends connection of the app's users.
What do I have to do to identify that UserA has just became friend with UserX?
Currently, anytime I receive a UserA's friends have changed notification from the facebook realtime api, I receive the whole /UserA/friends.json, paging throu the whole result to just identify what has been added since the last time.
While this works, it just feels like a lot of waste in compute-cycles and I like to know if there is a more elegant approach to this...
That's the way it is designed and there is no "solution" for it.
Note that this does not include the actual data values (either from
before or after the update). To obtain those, your app can request
them as normal, subject to the usual privacy restrictions. For data
that you have access to at any time, you may wish to query for that
data immediately following this callback so that it is ready for when
the user returns to your app.
Source: https://developers.facebook.com/docs/reference/api/realtime/
It makes a lot of sense, because Facebook is able to send you ALL UPDATES while not knowing if you have the appropriate permissions to get the new data, so a very easy way to do it in terms of privacy.
If you have a valid user token (in your db) you can retrieve the updated fields via Graph API / FQL and compare it with the data in your database. Without realtime API you need to pull data every x hours/days, which is even more waste of resources.
If you don't have a valid user token you can retrieve the updated fields via Graph API / FQL when the user comes back to your app and compare it with the data in your database. Without realtime API you always need to update/check the data when the user comes back.