`Hi All,
After LinkedIn API versioning, it seems that below projection parameter is not supported with creatives API call now :
com.linkedin.ads.SponsoredVideoCreativeVariables
com.linkedin.ads.SponsoredUpdateCarouselCreativeVariables
com.linkedin.ads.SpotlightCreativeVariablesV2
com.linkedin.ads.SponsoredUpdateCreativeVariables
com.linkedin.ads.JobsCreativeVariablesV2
com.linkedin.ads.SponsoredInMailCreativeVariables
Due to this, we are not able to fetch response similar to Old API call with new API now. This seems to be big impact to us.
For example , We are not receiving any of fields like 'showMemberProfilePhoto', 'forumName' for SpotlightCreativeVariablesV2 with new API which we used to get previously like mentioned below.
We have 2 headers in request as mentioned in LinkedIn API migration document.
X-Restli-Protocol-Version : 2.0.0
LinkedIn-Version : 202210
Old API call : https://api.linkedin.com/v2/adCreativesV2?ids=List({$creative_id})&projection=(results(*(variables(*,data(*,com.linkedin.ads.SpotlightCreativeVariablesV2(*,share~(*)))))))
Old API Response :
{
"results": {
"46524875": {
"variables": {
"clickUri": "$clickUri",
"data": {
"com.linkedin.ads.SpotlightCreativeVariablesV2": {
"showMemberProfilePhoto": true,
"forumName": "$forumName",
"description": "$description",
"logo": "$logo",
"headline": "$headline",
"callToAction": "$callToAction"
}
}
}
}
}
}
New API Call : https://api.linkedin.com/rest/creatives?ids=List(urn%3Ali%3AsponsoredCreative%3A{$creative_id})
New API Response :
{
"results": {
"urn:li:sponsoredCreative:$creative_id": {
"servingHoldReasons": ["$servingHoldReasons"],
"lastModifiedAt": 12345678000,
"lastModifiedBy": "",
"content": {
"reference": "urn:li:ugcPost:$ugc_post"
},
"createdAt": 1234562340000,
"isTest": false,
"createdBy": "$createdBy",
"review": {
"status": "APPROVED"
},
"isServing": false,
"campaign": "urn:li:sponsoredCampaign:$campaign_id",
"id": "urn:li:sponsoredCreative:$creative_id",
"intendedStatus": "ACTIVE",
"account": "urn:li:sponsoredAccount:$account_id"
}
},
"statuses": {
"urn:li:sponsoredCreative:creative_id": 200
},
"errors": {}
}
Is there any way to get all those fields we used to get in old API call with new API as we need these fields for processing.
`
Related
I'm trying to include a bad request (400) response schemas in the open api document for the web api I'm building in .NET 6. The problem is, the media type always defaults to application/octet-stream even though I explicitly set it to application/json.
My controller is decorated with the following attribute:
[ProducesResponseType((int)HttpStatusCode.OK)]
[ProducesResponseType(typeof(BadRequestResult), (int)HttpStatusCode.BadRequest, "application/json")]
But, the media type for the response 400 is incorrect in the generated open api document:
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Foo"
}
}
}
},
"400": {
"description": "",
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
}
Am I missing something or is this a bug in NSwag?
So this is no bug, I was using ObjectResult as the response type instead of ProblemDetails. Apparently this class could not be serialized or something and that produced a different response media type.
So no bug!
I'm building an e-shop on WordPress + WooCommerce and Android app that retrieving data from WooCommerce REST API. I'm using WooCommerce's REST API with JWT to get information about products, categories, etc. also make orders, adding to cart, etc.
It's good, if you have admin's OAuth 1.0a credentials, but, I'm using customer's JWT. I made WordPress accept this auth method (by my plugin).
If I make request to http://SERVER/wp-json/wc/v3/products/categories, I will get this error:
{
"code": "woocommerce_rest_cannot_view",
"message": "Вы не можете просматривать список ресурсов.",
"data": {
"status": 403
}
}
I'm passing Authentification: Bearer "JWT" and WordPress accept it, but WooCommerce don't give me any info.
How I made WordPress accept my JWT:
function test_rest_user($result, $th, $request){
$secret_key = defined('JWT_AUTH_SECRET_KEY') ? JWT_AUTH_SECRET_KEY : false;
$auth = $request->get_header_as_array("Authorization");
if ($auth){
$token = explode(" ", $auth[0])[1];
$user = api::exchange_token_to_wp_user($token, $secret_key);
if ($user){
set_current_user($user->data->ID);
}
}
}
add_filter("rest_pre_dispatch", "test_rest_user", 10, 3);
The main topic of this question is that WooCommerce not accepting JWT. This is response from WordPress REST API with customers's JWT (http://SERVER/wp-json/wp/v2/users/me):
{
"id": 7,
"name": "test",
"url": "",
"description": "",
"link": "http://SERVER/author/test/",
"slug": "test",
"avatar_urls": {},
"meta": [],
"_links": {
"self": [
{
"href": "http://SERVER/wp-json/wp/v2/users/7"
}
],
"collection": [
{
"href": "http://SERVER/wp-json/wp/v2/users"
}
]
}
}
So, I'd temporal solution. I made function, that hooks WooCommerce REST API permissions, you can Google how to do that. It hooks from woocommerce_rest_check_permissions filter. Just check is user logged in and provide access to methods. It's so easy!
I am testing a simple conversation from my dialogflow simulator using a fulfillment hosted in firebase functions.
And I am receiving the fulfillment response when triggered
But my simulator is showing this. Saying no response is received.
Please help
The complete RAW fulfillment response
{
"responseId": "99b660de-e2ca-4d8c-ace5-ef724fe5ee72",
"queryResult": {
"queryText": "male",
"parameters": {
"gender": "male"
},
"allRequiredParamsPresent": true,
"webhookPayload": {
"google": {
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "Amazing"
}
}
]
},
"expectUserResponse": true,
"userStorage": "{\"data\":{}}"
}
},
"outputContexts": [
{
"name": "projects/assurance-purple/agent/sessions/bf891cbe-8642-eb61-ed7b-d6796adfab60/contexts/_actions_on_google",
"lifespanCount": 99,
"parameters": {
"data": "{}",
"gender.original": "male",
"gender": "male"
}
}
],
"intent": {
"name": "projects/assurance-purple/agent/intents/96b523a0-7a3a-4135-bdfc-d9d8ad16b661",
"displayName": "getGender"
},
"intentDetectionConfidence": 1,
"diagnosticInfo": {
"webhook_latency_ms": 45
},
"languageCode": "en"
},
"webhookStatus": {
"message": "Webhook execution successful"
}
}
My actions on google Testing debug tab
`
{
"response": "We're sorry, but something went wrong. Please try again.",
"expectUserResponse": false,
"conversationToken": "",
"audioResponse": "",
"visualResponse": {
"visualElementsList": [
{
"displayText": {
"content": "Sorry, this action is not available in simulation"
}
}
],
"suggestionsList": [],
"agentLogoUrl": ""
},
"clientError": 4,
"is3pResponse": false
}
`
You don't show the entire response (copying and pasting it as text in your question would have been better), but it looks like you're sending a response back for an Action, but trying to test it in Dialogflow's conversation tool.
The Actions on Google response is slightly different than the response that Dialogflow expects to handle the additional features that the Assistant supports. Because of this, you need to use the Actions on Google simulator when testing your agent.
The Dialogflow test is looking for some specific fields to show the response that are not included with the actions-on-google library, and it will not show anything that is in a Google RichResponse object.
To summarize:
If you are working with an Action, use the Actions on Google simulator.
If you are working with other Dialogflow integrations, you can use the test tool on the right in Dialogflow.
Update
The error you're indicating from the AoG Simulator suggests that you're trying to just issue a statement in the conversation and not starting the Action, or that the Action has quit. Make sure you're talking to the action by starting it with "talk to my test app" or whatever the name of your Action is.
I have a java based service as the provider and a node JS app as the consumer.
I used a stub runner here https://github.com/spring-cloud-samples/stub-runner-boot for Node JS to run against the wiremock. But whether it's Node JS, browser or curl as client I get this "cursor" text in place of generated string from regex elements.
This is the contract:
request {
method GET()
url value(consumer(regex('/v2/accounts/[0-9]+')))
}
response {
status 200
headers {
contentType(applicationJson())
}
body (
"firstName": regex('[a-zA-Z]*'),
"lastName": regex('[a-zA-Z]*'),
"kycStatus": regex('FAILED|PASSED|PENDING|ERROR'),
"address": [
"streetAddress" : "3244 jackson street",
"city" : "City",
"state" : regex('[a-zA-Z]{2}'),
"zipcode": regex('^\\d{5}\$')
]
)
}
This is the actual response from wiremock:
Response:
HTTP/1.1 200
Content-Type: [application/json]
{
"firstName": {
"cursor": 9
},
"lastName": {
"cursor": 9
},
"kycStatus": {
"cursor": 27
},
"address": {
"streetAddress": "3244 jackson street",
"city": "City",
"state": {
"cursor": 11
},
"zipcode": {
"cursor": 7
}
}
}
I noticed that your cursor values are actually the number of characters in your regex. So that told me something was definitely wrong. I've never ran into this before.
I think you need to wrap your regex with value()
request {
method GET()
url value(consumer(regex('/v2/accounts/[0-9]+')))
}
response {
status 200
headers {
contentType(applicationJson())
}
body (
"firstName": value(producer(regex('[a-zA-Z]*'))),
"lastName": value(producer(regex('[a-zA-Z]*'))),
"kycStatus": value(producer(regex('FAILED|PASSED|PENDING|ERROR'))),
"address": [
"streetAddress" : "3244 jackson street",
"city" : "City",
"state" : value(producer(regex('[a-zA-Z]{2}'))),
"zipcode": value(producer(regex('^\\d{5}\$')))
]
)
}
I came across another example that affects request payloads in the same way, when generating wiremock stubs.
If I do not add at least one "field" to the request body, for example:
request{
// ...
body (
value(consumer(regex("[a-zA-Z0-9]+")), producer("derp"))
)
}
the request payload is required to be
{
"cursor" : 12
}
as seen by this wiremock stub generated in target/META-INF/.../mappings/myContract.json
"bodyPatterns" : [ {
"equalToJson" : "{\"cursor\":12}",
"ignoreArrayOrder" : false,
"ignoreExtraElements" : false
} ]
Solution
All I needed to do was add at least one field to the request body
body (
aMadeUpField: value(consumer(regex("[a-zA-Z0-9]+")), producer("derp"))
)
And the regex will now work for that field, as seen by my regenerated wiremock stub
"bodyPatterns" : [ {
"matchesJsonPath" : "$[?(#.['aMadeUpField'] =~ /[a-zA-Z0-9]+/)]"
} ]
This is probably why there is a line hidden in the documentation saying only JSON is supported for the request body.
Edit: Another thing to check is "anyBoolean()" which should be changed to "aBoolean()" and "anInteger()" which should be "anyInteger()" (SCC is i guess really inconsistent with naming...). I double check if they are right in IntelliJ by ctrl + hovering over the groovy methods and making sure they return DslProperty or ClientDslProperty
And, as the other poster said, be sure to wrap any regex() with value() and play around with consumer() and producer() if needed.
I am following campaign measurement guide to do
https://developers.google.com/analytics/devguides/collection/android/v4/campaigns
Google Play Campaign Attribution
General Campaign & Traffic Source Attribution
For the Google Play Campaign Attribution, after adding the campaign service and receiver to the androidManifest.xml, i followed the testing guide.
https://developers.google.com/analytics/solutions/testing-play-campaigns
In the log successfully received the install referrer intent.
07-29 17:05:32.968 8333-8363/? D/GAv4: Received installation campaign: content=test_content, keyword=test_term, medium=test_medium, name=test_name, source=test_source
But in my google analytic account, Acquisition -> Sources -> All, nothing shows up. Can anyone have any idea what is the root cause?
I also implemented the hit screen analytic, this is working.
My google-services.json is below:
{
"project_info": {
"project_number": "123456788680",
"project_id": "test-app-project"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:12345678680:android:488edac1c6c2df62",
"android_client_info": {
"package_name": "com.example.test.analytic"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "xxxxxxxx_xxxxxxxxxxxxxxKoT0XEkMgOCUe0c"
}
],
"services": {
"analytics_service": {
"status": 2,
"analytics_property": {
"tracking_id": "UA-xxxxxxxx-2"
}
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 1
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:12345678680:android:6092a3d09b6b18d2",
"android_client_info": {
"package_name": "com.example.test"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "xxxxxxxx_xxxxxxxxxxxxxxKoT0XEkMgOCUe0c"
}
],
"services": {
"analytics_service": {
"status": 2,
"analytics_property": {
"tracking_id": "UA-xxxxxxxx-2"
}
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 1
}
}
}
],
"configuration_version": "1"
}
I modified the project name and the key to post here. In my actual project, i didn't modify anything. There are 2 clients with different package name, because i have 2 projects, one is the main entry app and another is the library. All both needs to send info the google analytic. But both in one application, so I set it to use the same analytic property when request configuration form google. Is that impact? I think it shouldn't.
Can anyone help me?
For me, the information was not sent before building the tracker for the first time.
After sending the broadcast I also only get:
D/GAv4: Received installation campaign: content=test_content, keyword=test_term, medium=test_medium, name=test_name, source=test_source
Then after sending my first own tracking information to Google Analytis, I get:
D/GAv4: Sending first hit to property: UA-63098830-1
D/GAv4: Found relevant installation campaign: content=test_content, keyword=test_term, medium=test_medium, name=test_name, source=test_source
D/GAv4: Sending installation campaign to: UA-63098830-1, content=test_content, keyword=test_term, medium=test_medium, name=test_name, source=test_source