box.com TAG_ITEM_CREATE event - box-api

In the box docs, it states that the event TAG_ITEM_CREATE occurs when 'A Tag was added to a file or folder'. Is there any way to find out which folder/file the tag was added to ,without iterating them all?

If you're fetching events for a Box enterprise you can have Box perform server-side filtering of events. However, when fetching events for a standard Box account you must do the filtering in your application. The next_stream_position parameter can be used to set a lower time bound for the events that you receive, which can significantly reduce the amount of metadata that you have to sort through.
EDIT: Answering questions from comment.
Q: Not sure how filtering events helps me work out which folder has been tagged?
The event object that's returned to you will look like this:
{
"next_stream_position":1348790499819,
"entries":[
{
"event_type":"TAG_ITEM_CREATE",
"source":{
"type":"folder",
"id":"11446498",
... more event info ...
}
},
... more events ...
]
}
In your application you can look for those events whose event_type is TAG_ITEM_CREATE. You can then use the source to determine which particular resource was tagged.
Q: Are you saying that I can ask for all folders changed since a given TAG_ITEM_CREATE event?
No. Think of the 'next_stream_position` property as a proxy for a timestamp. You can use it to tell Box, "Tell me about all the events that occurred after this 'position' in time." But this will still give you all types of events that occurred. You'll have to select the events of interest in your application.
This is one of the big differences in the Enterprise- and User-facing APIs. In an Enterprise you can tell Box, "I want info on all the TAG_ITEM_CREATE events that occurred in the Enterprise between yesterday and today." In the User-facing API the best you can tell Box is effectively, "I want info on all events that occurred in this User's box since yesterday."

Related

Passing back value from Browse-Child VM chain to caller

MVVMCross
Windows Store
Android
I have a VM that browses a hierarchy (BrowseVm) and supports forward navigation via
ShowViewModel<LeafDetailVM>
to a leaf detail ViewModel (LeafDetailVM).
When the user is on the LeafDetail View they should be able to say "I want this one" and they will be returned to the View that initiated BrowseVm.
I cannot simply Forward Navigate to the Initiator because that would leave me with an invalid back stack. I cannot have the BrowseVM view as a NoHistory page as I need it be in the back stack to support going back from the LeafDetail view.
My plan is to have the initiator start BrowseVm with a GUID. BrowseVm will pass that GUID onto LeafDetailVM.
In the "I want this one" command I will raise a Message, containing the GUID, that both BrowseVM and the initiator are subscribed to. Then I will close LeafDetailVM.
When BrowseVM receives the notification of the message it will compare the GUID and if it matches it will close itself.
When the initiator receives the notification it will deal with the now chosen data.
Does this make sense? Have I missed a much simpler way of doing this?
This is similar to How to pass a parameter from a viewmodel to its parent viewmodel but that does not deal with the back stack.
Thanks
I suggest you try stop mentally coupling how the views work on a platform to the view-models.
With the custom presenter mechanism in MvvmCross, in the app (platform specific code) you can handle navigation to a certain view-model in different ways, including closing views, modify backstack, etc.
You can interpret navigation to a view-model in whatever way you want \ need.
You can for example pass from view-model some parameters in the ShowViewModel request which the view-presenter (IMvxViewPresenter) can interpret in different ways in the Show() to display a view-model.
In your case, you can actually navigate to initiator VM passing the selected info. In the view presenter, you can modify the backstack in the way you need.
On Android, make sure you read and know about all LaunchMode flags, for example LaunchMode.SingleTask which allows you bring the initiator activity to front without creating a new one.
It's not clear to me, is BrowseVm a parent view-model to the LeafDetailVM?
More info would be needed to understand exactly your scenario.

HTML: Possible to get keyboard event data without a keyboard event?

In order to get the keyboard state we can listen to "keydown" event but is it possible to interrogate the keyboard without an event? Something like window.keyState.shiftkey?
In 2018 I'm investigating the same thing: (re-)initialisation on acquisition of focus.
Initialisation (determination of system state) is required when the application starts. It is required every time the application recovers focus after losing it to another application, because state like NumLock can change while the application does not have focus.
As the question notes, this information can be obtains from event objects.
There doesn't appear to be any way to request this information.
This requires a change to browsers. In my opinion a low impact solution
for this and parallel situations is a general mechanism for requesting a "null event" of a specified type, eg
var ke = window.requestEvent("keyboard");
var me = window.requestEvent("mouse");
var te = window.requestEvent("haptic");
Since a keyboard/mouse/touch event is not actually occurring, the field that would otherwise quantify the event (key code, mouse position etc) should be null.
This API should not be a breaking change for event handlers, since it doesn't actually trigger an event, it's a function that returns an event object. It's completely new so there is no legacy code, and it can be extended without change simply by defining more event class strings. No new data structures are defined.
If I knew how to submit a change request to the pertinent browser standards committee, this seems to me like a very tight, robust, compatible solution to several problems. I'm recording this here as a sort of message in a bottle, in the hope that one day it will be seen by someone who can act on it.

How to get source of ITEM_SHARED_CREATE and ITEM_SHARED_UNSHARE events?

For most events in the Box API, the source field of the event notifies the client of which object has changed.
For the two sharing events, ITEM_SHARED_CREATE and ITEM_SHARED_UNSHARE, the source field of the event is always set to null. AFAIK, there's no ID in the event entry that points back to the object that has been shared or unshared. Without doing a full rescan of the Box filesystem via the API, is there a way to determine which files/folders have been shared/unshared?
Here's an example response, note the null source field:
{"type":"event",
"event_id":"57b34bc08ed2720fb72c2a1aba56cc6b399e8e7d",
"created_by":
{"type":"user",
"id":"xxx",
"name":"Joe Polastre",
"login":"joe#xxx"},
"created_at":"2013-02-14T20:39:22-08:00",
"recorded_at":"2013-02-14T20:39:23-08:00",
"event_type":"ITEM_SHARED_CREATE",
"session_id":"925514914511d78b532462",
"source":null}
This looks like something we need to fix on our end. Please email into us at API AT box.com if you'd like to be updated on the progress we make.

Stream Position Returned By Box API Cannot Be Used To Track Events

Thanks for your reply for my question: Is this a bug of Box API v2 when getting events
This is a new problem related to this. The problem is that I cannot reliably use the next_stream_position I got from previous calls to track events.
Given this scenario:
Given the following two GET HTTP queries:
1. GET https://api.box.com/2.0/events?stream_position=1336039062458
This one returns the JSON file which contains one file entry of myfile.pdf and the next stream position = 1336039062934
2. GET https://api.box.com/2.0/events?stream_position=1336039062934
This call uses the stream position I got from the first call. However, it returns the JSON contains the exactly same file entry of myfile.pdf with the first call.
I think if the first call gives a stream position, it should be used as a mark for that exact time (say: TIme A). If I use that stream position in subsequent queries, no events before "Time A" should be returned.
Is this a bug? Or did I use the API in the wrong way?
Many thanks.
Box’s /events endpoint is focused on delivering to you a highly reliable list of all the events relevant to your Box account. Events are registered against a time-sequenced list we call the stream_position. When you hit the /events API and pass in a stream_position we respond to you with the events that happened slightly before that stream position, up to the current stream_position, or the chunk_size, whichever is lesser. Due to timing lag and our preference to make sure you don’t miss some event, you may receive duplicate events when you call the /events API. You may also receive events that look like they are ‘before’ events that you’ve already received. Our philosophy is that it is better for you to know what has happened, than to be in the dark and miss something important.
Box events currently give you a window roughly 5 seconds into the past, so that you don't miss some event.
We have considered just delaying the events we send you by about 5 seconds and de-duplicating the events on our side, but at this point we've turned the dial more towards real-time. Let us know if you'd prefer a fully de-duped stream, that was slower.
For now, (in beta) if you write your client to check for duplicate events, and discard them, that will be best. We are about to add an event_id to the payload so you can de-duplicate on that. Until then, you'll have to look at a bunch of fields, depending on the event type... It's probably more challenging that it is worth.
In order to help you be able to figure out if an event is a duplicate, we have now added to each event an event_id that will be unique. It is our intention that the event_id will allow you to de-duplicate the responses you receive from subsequent GET /events calls.
You can see this reflected in the updated documentation here, including example payloads.

What is the difference between the BU and ZK OK codes in SAP macro

I am trying the post an invoice to SAP using the F-47 transaction and using SHDB to record the transaction and learn how it works. I see there that sometimes BU and ZK BDC OK codes are used. I would like to understand the difference between them, but could not find any official documentation. Please, explain the difference between the two?
I found the meaning of some of the status codes. I post it here, so I can remember:
/00. Enter
/AB Go to overview
=ZK Go to additional information
=ENTE Enter (don't know exactly what is difference between /00)
=PI select cursor location
=STER Go to taxes
=DELZ delete cursor
=GO continue
=BU post (save)
/EEND end processing
=Yes select "yes" from message box
=BP park (save)
=ENTR Enter (don't know exactly what is difference between =ENTE or /00)
=AE save when changing document
=BK change document header (parking or posting parked document)
=P+ next page
=BL delete parked document
A BDC_OKCODE indicates which action is (will) be executed on a screen (things like save, back, exit etc). The BU code is used for a SAVE function (like in MM01 transaction). Sorry but I cannot recall to which function ZK maps to. Obviously their difference lies in the fact that they map to different functions. You can still find out which function each button utilizes by using System->Status->GUI status.
By the way, BTCI transactions are not fully robust- minor changes in GUI flow let your program break. Error handling / analysis is tedious.... DId you have a look to posting methods more preferably? E.g. like BAPI_* function modules? With the help of LSMW you can browse for different input methods and use them later standalone. Or you can use transaction BAPI directly.