Pinterest API: pass multiple values in entity_fields parameter - java

In using this Pinterest Analytics API:
/ads/v3/reports/async/{advertiser}/delivery_metrics/
I am successful when the entity_fields parameter is a single value like this:
https://api.pinterest.com/ads/v3/reports/async/<advertiserId>/delivery_metrics/?start_date=2021-04-04&end_date=2021-04-05&level=PIN_PROMOTION&entity_fields=AD_GROUP_ID
however I also need the CAMPAIGN_ID, but when I try to include more than one value in the entity_fields parameter I get bad request. I have tried several forms, and all the following fail:
entity_fields=CAMPAIGN_ID&entity_fields=AD_GROUP_ID
entity_fields=CAMPAIGN_ID AD_GROUP_ID
entity_fields="CAMPAIGN_ID AD_GROUP_ID"
Here is an example of the error, although the exact syntax of the error depends on how I tried to parameterize entity_fields:
{"code":1,"data":null,"endpoint_name":"ads_v3_create_advertiser_delivery_metrics_report","error":{"message":"Parameter 'entity_fields' (value CAMPAIGN_ID AD_GROUP_ID) is not one of PRODUCT_GROUP_ID, PIN_PROMOTION_ID, PIN_PROMOTION_NAME, PIN_PROMOTION_STATUS, AD_GROUP_ID, AD_GROUP_NAME, AD_GROUP_STATUS, CAMPAIGN_ID, CAMPAIGN_NAME, CAMPAIGN_STATUS, CAMPAIGN_MANAGED_STATUS. "},"message":"Invalid parameters.","message_detail":"Parameter 'entity_fields' (value CAMPAIGN_ID AD_GROUP_ID) is not one of PRODUCT_GROUP_ID, PIN_PROMOTION_ID, PIN_PROMOTION_NAME, PIN_PROMOTION_STATUS, AD_GROUP_ID, AD_GROUP_NAME, AD_GROUP_STATUS, CAMPAIGN_ID, CAMPAIGN_NAME, CAMPAIGN_STATUS, CAMPAIGN_MANAGED_STATUS. ","status":"failure"}
How does the Pinterest api server expect the entity_fields parameter to be formatted? Thanks in advance for any insight here.

Sorry to answer my own question, but I heard back from pinterest support. To pass multiple field names in the entity_fields parameter, separate by comma:
https://api.pinterest.com/ads/v3/reports/async/<advertiserId>/delivery_metrics/?start_date=2021-04-04&end_date=2021-04-05&level=PIN_PROMOTION&entity_fields=AD_GROUP_ID,CAMPAIGN_ID

Related

How do I respond to tickets with camel Jira Producer?

I'm following the examples here -> https://github.com/apache/camel-k-examples. Working on 05-knative-source-jira
When running this integration, I'm able to read and log new jira issues just fine, I fall down when I try to use info from the ticket, or respond to the ticket with the jira addComment producer.
I've tried just putting a static ticket number in for the IssueKey option, but I get build errors and can't even get the producer to run.
I've tried tinkering with the URI...
Ex: Changing URI to -> .to("jira://addComment?IssueKey=EQ-7") returns below on build
No signature of method: org.apache.camel.builder.ValueBuilder.to() is applicable for argument types: (String) values: [jira://addComment&IssueKey=EQ-7]
I've tried this with both ? and &, as well as adding properties to the URI with similar results.
I feel like I'm missing something pretty fundamental, so any docs pointers would be well appreciated.
Full integration here
// camel-k: language=groovy
from('knative:channel/jira')
.unmarshal()
.json()
.log('Recieved: ${body}')
.to('direct:ticket')
from("direct:ticket")
.setBody().simple("testing")
.to("jira://addComment?IssueKey=EQ-7")
I ended up sorting through enough docs to find the answer. I'll share details just for others who might find this (or if I google it again).
The key was to
a) Set the required headers for the issue key. Seting headers examples
b) Ensure that my properties are set correctly. I used a configmap to set my properties, and then referenced them as shown below in the URI. I believe this should also be possible through DSL but URI was easiest for me to just get working.
Functional Integration below.
from("direct:ticket")
.setHeader("IssueKey").simple('${body["key"]}')
.setBody().simple("We've recieved the ticket -- we'll update you soon!")
.to("jira://addComment?jiraUrl={{url}}&consumerKey={{consumer_key}}&accessToken={{access_token}}&privateKey={{private_key}}&verificationCode={{verification_code}}")

Spring Security antMatcher expression not works with path variable

I need to provide certain role for accessing a URL in the following format:
/connector/{programId}/order/{anything here}
Where programId is an integer value so I'd tried the following and it doesn't work at all.
.antMatchers('/connector/{programId:\\d+}/order/**').access("hasRole('CONNECTOR')")
But when I used ** instead of the programId part it's working well. But how can I make it work with pathVariable (which is always an integer).
You should use RegexRequestMatcher instead of AntPathRequestMatcher.
.regexMatchers("/connector/(\\d+)/order/.*").access("hasRole('CONNECTOR')")
I am using:
.regexMatchers("/connector/(\\d+)/order/.*").access("hasRole('CONNECTOR')")
But server response 405 error

Issue while setting the parameter

I need to set the flow execution parameter to my flow, I tried as follows,
studentFlowURL.setParameter("execution","${flowExecutionKey}");
It is showing the following exception,
Badly formatted flow execution key '${flowExecutionKey}', the expected format is 'e<executionId>s<snapshotId>'
Any suggestion how to pass the value of ${flowExecutionKey} as a string to the execution attribute
I am not sure what you are doing, but try using:
${flowExecutionContext.key}

Play Framework not recognizing path parameter

I am working on a web-app using the Play Framework. I am trying to pass a variable through a dynamic URI. I am following the example shown here. However, I am getting this error:
not enough arguments for method showClients: (clientId: Long)play.mvc.Result. Unspecified value parameter clientId.
routes file:
GET /clients/{clientId} controllers.Application.showClients
Controller Code:
public static Result showClients(Long clientId) {
Client c = clientFinder.byId(clientId);
return ok(client.render(c));
}
URL
http://localhost:9000/clients/1
Does anyone see a problem with my code? After googling around, I have found similar questions, but no one with the exact same problem, so I am thinking it is something simple. Thanks for the help.
Whoops...It looks like I was looking at documentation for a previous version of Play. The current documentation here shows that my routes file should look like this:
GET /clients/:clientId controllers.Application.showClients(clientId : Long)
Thanks to anyone who looked into finding an answer to the question.

Disqus API for getting the list of posts from the forum

I am using the Disqus API for getting the list of posts for a particular forum.
The url that i am using to get the posts is -
'http://disqus.com/api/3.0/forums/listPosts.json'
In the disqus api docs they have provided the parameters that can be passed to the above url. Out of which 'since' is one, which can be used to get all the posts after the specified date.
In the api docs they have mentioned that we can use Unix timestamp (or ISO datetime standard) as the value for the 'since' param.
I have tried with both types of values but it gives me all the posts i.e. the since constraint is never applied.
Can you please help me out to know how to use 'since' param.
Thanks !!
yes the order param is bydefault set to 'desc'...you can get more info on this link: http://disqus.com/api/docs/forums/listPosts/
I use mootools, can you show me javascript code for that ajax request?
My js is:
new Request.JSONP({
url :"https://disqus.com/api/3.0/threads/list.jsonp?api_key=9ldXlWCWlsyjMI3qvf03Y8OQCNxvAMklHkrNVcpBKm220XJHXsU0QDdr0TCLM1kz",//&forum=colourasexperience&thread=ident:cae52020",
callbackKey: 'showMyInfoes',
onSuccess: function(jdata){
//console.log(jdata);
}
}).send();
Thanks

Categories