RESVT Bulk Update - rest

I had a question last month about POSTing to Workfront's RESVT field. Since then, I've completed my database to pull all of our department's Leave Calendar data and feed it into Workfront's API as POST methods; however, I've discovered a new problem.
Every time I add a new RESVT event to a user with an existing RESVT event, it deletes the previous event before it saves the new event. I've looked into submitting a bulk edit using the bulk editing format to get all of the events for a user online all at once like this:
https://sosprojects.preview.workfront.com/attask/api/v9.0
/5b6b72b5007d93b00b00dda361398cad?method=put&updates=
[
{
objCode:”RESVT”,
startDate:”2018-08-20T00:00:00:000-0700”,
endDate:”2018-08-23T00:00:00:000-700”
},
{
objCode:”RESVT”,
startDate:”2018-09-20T00:00:00:000-0700”,
endDate:”2018-09-23T00:00:00:000-0700”
}
]
&sessionID=209055d209f94662b32ac50175b34bc7
Which Workfront "accepts" (it doesn't spit out an error code), but it still only saves the last RESVT event (e.g. 9/20 - 9/23).
I've tried using PUT to edit an existing RESVT event, but each RESVT event will only accept one start and one end date so it collapses those attempts into one extra long event.
I know the time-off calendar can manually create multiple RESVT events per user, but I can't figure out how to replicate that feat with my http methods. The calendar always creates new RESVT events for every event logged whenever I add a new event to it; so I think it is doing something like the bulk POST I tried at the top, so why can't my method do the same thing?

The API docs don't show update as a valid method for the RESVT object. Just modify the fields directly for the specific object you want to update. Do you know its ID?
PUT https://<url>.my.workfront.com/attask/api/v9.0/RESVT/<ID of the reserved time you want to edit>?userID=abc1234,startDate=<date>,endDate=<date>

Related

how to add row based on expiry date on others row?

so I have a table A which has a column expiry date. When this date is passed I have to call a API and add new data to table. What is way to do this
things i have thought of are
Database trigger: The problem is trigger can be set only on update, insert.
Creating a separate service which checks expiry, call api and add new data, this problem is expiry_date is just for some seconds, so if this api is slow i will not be able to show latest data.
The main problem i feel with both of solutions is db will receive lots of queries, so i wanted to know if there is other way?

Is there any way to get deleted row data from smartsheet using webhooks

To notify the events on smartsheet, I have created a webhook. Using I am able to get all events performing on sheet. If I delete a record manually, I am getting the deleted event with rowid, but not the total deleted row data. Is there any way to get the deleted row data?
Thanking you in advance
The callbacks that you receive via webhooks are simply intended to notify you when events occur -- i.e., by design, each callback contains only enough data to identify the event that triggered the callback.
Update 10/19/2020:
Unfortunately, you won't be able to use the Get Row operation to retrieve data for row after it's been deleted. Therefore, seems like you'd need to somehow write/save sheet data elsewhere as the sheet is modified (e.g., perhaps in response to webhook notifications that indicate row data was added/modified?), then you could query this saved sheet data to get row data as rows that are deleted from the actual sheet (i.e., in response to 'row deleted' webhook notifications).

How to manage Daily Bonus push notification with One Signal?

We have a daily bonus system working on date basis. Every date in your local time, you have right to take 1 daily bonus. Ex: If you get daily bonus on 12 July, you will get right to take next bonus on date 13 July without depending on time.
I would like to create push notification for users, but i could not sort it out how to do it?
My previous tries:
1- Whenever player gets daily bonus, i tried to create notification for the next day at 8 pm in her local time.
Problem: If player takes bonus on the next day before 8 pm, i could not delete previously created notification, because there is no delete function for Unity. I also tried collapse_id to deal with it, but collapse_id do not stop sending the notification, just updates notification info with the last one when it is received.
2- I created a tag which is the date when bonus collected, it is something like "2018-07-12". I tried creating a user group who compares these tag with the "today's date"
Problem: there is no such thing like todays date you had to enter it as value, so you can do this by entering console changing date and sending notification and you need to do it everyday.
How can I create such notification system?
Thanks.
Hasan
There are 2 options to do this with OneSignal.
1 - You can cancel the notification if the user already took the bonus.
You can use something like this to make the cancel request:
string url = ""https://onesignal.com/api/v1/notifications/"" + notificationId.ToString() + ""?app_id="" + s_appId;
WebRequest request = WebRequest.Create(url);
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
request.Method = ""DELETE"";
request.GetResponse();
2 - If you are tracking this on your own CRM or database, then you can save the OneSignal PlayerID to the database and target device with the API.
First, get the playerID with the SDK: https://documentation.onesignal.com/docs/unity-sdk#section--getpermissionsubscriptionstate-
Then you can send this data to your CRM or database: https://documentation.onesignal.com/docs/internal-database-crm
​
You can then use include_player_ids on the create notification REST API POST call https://documentation.onesignal.com/reference#section-send-to-specific-devices
If you want to go the tagging option, you should use a timestamp and then target with the API and filters https://documentation.onesignal.com/reference#section-send-to-users-based-on-filters
You should never put your OneSignal REST API key within your app. This needs to be kept private.

lazy loading meteor subscription

Say I subscribe 10 documents when the page is rendered and subscribe more documents as and when needed. Basically I am showing images to the user. So when the page is opened, I want to subscribe the first 5 documents. Now when the user is on 3rd document, I want to subscribe the next 5. Any help on how to proceed??
I can subscribe to the first 10 documents using limit property of mongodb. I know when to fire the next meteor.subscribe call but how should I mention that it should subscribe the next five documents
A simple pattern to do this is to use a Session variable or a reactiveVar to track how many items you want to load then have a Tracker.autorun() update the subscription automatically when that changes.
Initialize (when you're setting up the layout):
Session.set('nDocs',10);
Tracker:
Tracker.autorun(() => {
Meteor.subscribe('myPublication', Session.get('nDocs'));
});
Event Handler (triggered when the user views the 3rd doc in your case):
someEvent(ev){
Session.set('nDocs', Session.get('nDocs')+10);
}

Why JsonStore provides a commitchanges method

The extjs Jsonstore class has a method commitchanges().
Now considering that the javascript code will send an AJAX request to a servlet and not to a db directly, what do we need a commitchanges() method?
Whenever user changes anything in the form panel's or UI components that data is changed in record, but at this time record will maintain a list of modified properties in the record and store maintains a list of modified records in the store
So whenever you send a request to save the data to server, after successful save you will get back a success response, on this response store need to make sure that the saved record will be removed from the list of records that are modified in the store and also remove list of modifications from the record instance to indicate that save operation was successful
So the operations of removing list of modified properties from record instance is performed by record.commit method and operations of removing saved record from list of modified records from store is performed by store.commitChanges method which in turn will call record.commit for every record which is saved correctly on server