Community Discussion
How to turn logging off?
Hey.
I am using Java SDK, how can i turn logging off?
Thx,
Elvar
Posted by Elvar Liiv over 2 years ago
Calculating the Publisher spend for the last 24 hours
Hi,
For our requirements, in each account I need the last 24 hours' spend per Publisher.
With the Java SDK, I can easily get the spend per site in daily chunks using the **SITE_BREAKDOWN** dimension, however this doesn't support anything finer-grained, for instance if I want to know the spend from midday yesterday until midday today.
It doesn't look possible through the Java SDK.
I've also looked at calling the Backstage API directly, but even then it looks like I can only perform what I need one site per call using **campaign_hour_breakdown** with a site filter...
```
https://backstage.taboola.com/backstage/api/1.0/<account>/reports/campaign-summary/dimensions/campaign_hour_breakdown?start_date=2021-02-08&end_date=2021-02-09&site=<site name>
```
Our app can then aggregate the values in the response to calculate our spend on a site for the last 24 hours.
Given that we are using thousands of Publishers, this could take some time!
I'd love to know if there another more performant way of doing this?
Cheers,
Colin
Posted by Colin MacLean over 2 years ago
Java Backstage SDK - Update Campaign Item fails
I'm trying to toggle a campaign item's active status, however it returns with a 400 error:
```
Exception in thread "main" com.taboola.backstage.exceptions.BackstageAPIRequestException: Failed to perform API call with response code [400]. Response payload status [400], message [Unknown field name 'active'], offending field [null], message code [api.action.bad_request.null]
at com.taboola.backstage.internal.SynchronousCallAdapterFactory$1.adapt(SynchronousCallAdapterFactory.java:70)
at retrofit2.HttpServiceMethod$CallAdapted.adapt(HttpServiceMethod.java:165)
at retrofit2.HttpServiceMethod.invoke(HttpServiceMethod.java:146)
at retrofit2.Retrofit$1.invoke(Retrofit.java:160)
at com.sun.proxy.$Proxy3.updateItem(Unknown Source)
at com.taboola.backstage.services.CampaignItemsServiceImpl.updateItem(CampaignItemsServiceImpl.java:87)
```
My code is pretty simple (vars spoofed)...
```
Backstage backstage = Backstage.builder().build();
String accountName = "account123456";
String campaignId = "123456";
String itemId = "987654321";
CampaignItem item = backstage.campaignItemsService().readItem(clientAuth, accountName, campaignId, itemId);
logger.info("ID:{} active:{} status:{} name:{}", item.getId(), item.getActive(), item.getStatus(), item.getTitle());
// Update status to opposite
CampaignItemOperation operation = CampaignItemOperation.create().setActive(!item.getActive());
CampaignItem updatedItem = backstage.campaignItemsService().updateItem(clientAuth, accountName, campaignId, itemId, operation);
```
The code fails on the last line, with the above exception. Any ideas what I'm doing wrong?
As you can see, I'm able to retrieve the Campaign Item just not update its active value.
Posted by Colin MacLean over 2 years ago