Can I get a Google Form json response object without having to set up OAuth? - google-forms

I am working on a project to take a Google Form and transpile it into Lua for usage within Roblox experiences.
Take this form:
https://docs.google.com/forms/d/e/1FAIpQLSeKIzg67ZWJAr9VXfgODj0xFE73yA40lidbMcEAytP5EhwfZA/viewform
Form with a simple title and radio button
Looking at the example response objects from the onboarding guides
https://developers.google.com/forms/api/guides
I can infer that the response would look something like this
{
"formId": "FORM_ID",
"info": {
"title": "Example Form",
"description": "Example Form Description",
"documentTitle": "Example Form"
},
"settings": {
"quizSettings": {
"isQuiz": false
}
},
"revisionId": "00000021",
"responderUri": "https://docs.google.com/forms/d/e/1FAIpQLSeKIzg67ZWJAr9VXfgODj0xFE73yA40lidbMcEAytP5EhwfZA/viewform",
"items": [
{
"itemId": "5d9f9786",
"imageItem": {
"image": {
"contentUri": "DIRECT_URL",
"properties": {
"alignment": "LEFT"
}
}
}
},
{
"itemId": "0a4859c8",
"title": "Question 1",
"questionItem": {
"question": {
"questionId": "37fff47a",
"choiceQuestion": {
"type": "RADIO",
"options": [
{
"value": "Radio Button Label 1"
},
{
"value": "Radio Button Label 2"
}
]
}
}
}
}
]
}
Ideally I would like to be able to fetch form responses with API keys only, but it doesn't seem like thats allowed with the new Forms api. In that case - automatic fetching of the form information is out of the question (OAuth is far too much overhead / impractical to set up), so what I would like is the ability to easily fetch the json object for a form i'm the owner of.
I checked the network traffic for the forms page and it just returns all the HTML required to display, nothing like a the nice Form object you would get from the developer APIs. The "Try it out" feature in the API documentation still requires OAuth.

Related

Q: Linkedin Vector Assest API, Registering Multi-Part Upload - No metadata value in response

I'm attempting to complete a multipart upload using Linkedin V2 Vector Assets and i've noticed that when registering the upload, the metadata field comes back blank in the response.
Here's the request to register the upload https://api.linkedin.com/v2/assets?action=registerUpload
{
"registerUploadRequest":{
"owner":"urn:li:organization:71736744",
"recipes":["urn:li:digitalmediaRecipe:feedshare-video"],
"serviceRelationships":[
{"identifier":"urn:li:userGeneratedContent","relationshipType":"OWNER"}
],
"supportedUploadMechanism":["MULTIPART_UPLOAD"],
"fileSize":50866165
}
and here is the response (removed all but one partUploadRequests object to make the response easier to read)
{
"value": {
"uploadMechanism": {
"com.linkedin.digitalmedia.uploading.MultipartUpload": {
"partUploadRequests": [
{
"headers": {
"Content-Type": "application/octet-stream"
},
"byteRange": { "lastByte": 4194303, "firstByte": 0 },
"url": "https://www.linkedin.com/dms-uploads/C5605AQFnYcNsf7K5Yw/uploadedVideo?sau=aHR0cHM6Ly93d3cubGlua2VkaW4uY29tL2FtYnJ5L2FtYnJ5LXZpZGVvLz94LWxpLWFtYnJ5LWVwPUFRRmp4SlBwRndkUUNnQUFBWGhjYkgwNzNuZmpacTRFM3AxUkpidTMxTlAxems3WmdoUHN1Ymp1TjVGTXVDRGFOaGczVnpHWXNpLW5OYWh2NlkxWkU5UDVIdktsQ2JxbGhhOUt1SElJSnBXTjI0TkEyWDIzM1ZiaS1aNW4yTmlXWWQyX1VlN1J2d0FEdkMwSG51ckNMY1ljMkdrczhKclFlZHRYNlZNN2dvTFJad2hpT0pxcFNZM29mXzdTTmRhZjZzQlNMS3FwaTJyWF9LYTRqTk9OcnBhTFpCam1KR3ZENEV3ZFd0VHEzNm44aEFQbDhCMmc3cVpOd3Q0Ny1TT1ZvcHRoT0dWcTB0cHAxU2VkbkY2aVNVQ3J6RVlwVHdzNDZTQlViME5HbGxITHo4a1ZNOGJxYkJjMDVCc054MDQ2ZDktZWdGb2RFa3ZKRmxsU0NRWFV2ZzdQb3VFaVNodkZtSHRYVHhLLWlkbnpKWjlQN1Q2b1ROQWJhWE5iR2g2QUdBQmQ3VVdjNkdGb01YaWFiazBhRlA4UzNpUXNlM05ISFNVdkFBdk1nSnV2a0xxWV9oYU1VTXdoeXFRT0w1a0NLM1NSd2RXTnpKSHZLMkhfY0ZqclYzcnB4VXJZckkxbUZ2QVl2Y3dUcVYyaDhWWHRpY1luNTA0am1jUjN3U0M5RVVQZEo2RFZEd1RJRmFvOTJYcmszbTFNS2pSRlFZMV94enVHZVk4SERKWTQwbDQySVRJNXlCLUp3b2V3Vjl3RGduOTZycmhoY1pLa0VOck5vdUZ4eDdodlBTNkZUVXcweXJWM3BaOUF5X2NtaHBXTVpwOVRFY0pJcGY3elFrQTF3ZFcyR3VIcEtGLUF4MldTZTdlR1pCOTdHaU5vLW9XamhkV2stR2MzNFh5UjFwckZsTF9sSFFUWU40S2pNLUI2Y2poZHFJV2xVTll6Z1lVaXdwNld2UEYwVFRObW5kQVgtTTBlX1VsaGFOQ190SDFEcG9Kem5IZExoN3IxMGk5VWE4MGpsZ3pDQzBsT3JKSkxuSEcwNm9jVzNJSzctT3NSZGhBSEFNdTBuWDNRdlhfSFoxWXpfNXgza3dyZzBPOVlmN2xIUFFiVW1lYllReUlJaGdxOEE1blpxVUxzeUpvZElLWk5WdUdlcjVuN21jTFV4TzRtNlBUczVtc3pHS0x4Z3o4b2FDdVNiWWliYzh2NkpxQktiN2RmejdnQWRFVVpfNnRLenVxUm11bGk5OGZVSVpOR3hfc3R1Mk9nVDYzYXRoQmZnRHQ0dGpnVi1BOWlaVXdtYWNLckxwVE5wNUdHZlBxZjhLaE1MZC1BVXotSVNoX19jRUlzM2laSXlpeC1pNlFpeGZyRmpxQnYwaDhwOGZpeXZ0Q2Job0xjU1g4aWNjX0lSX28xQXR0UmZB&pn=1&m=616825227&app=86804616&sync=0&v=beta&ut=1nBLJxAvwH5FI1",
"urlExpiresAt": 1616544717116
} ...
],
"metadata": ""
}
},
"asset": "urn:li:digitalmediaAsset:C5605AQFnYcNsf7K5Yw",
"mediaArtifact": "urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:C5605AQFnYcNsf7K5Yw,urn:li:digitalmediaMediaArtifactClass:uploadedVideo)"
}
}
The api documentation explains that I need to use the metadata value from the register upload response to complete the upload
I attempt making the request anyway without a value for the metadata field to https://api.linkedin.com/v2/assets?action=completeMultiPartUpload (removed all but one partUploadResponses object to make the response easier to read)
{
"completeMultipartUploadRequest": {
"mediaArtifact": "urn:li:digitalmediaMediaArtifact:(urn:li:digitalmediaAsset:C5605AQFnYcNsf7K5Yw,urn:li:digitalmediaMediaArtifactClass:uploadedVideo)",
"metadata": "",
"partUploadResponses": [
{
"headers": {
"ETag": "/ambry-video/signedId/AQGpSasdC3ezCgAAAXhcbTobXlB6_ujllr8BPUUAX4o9OgbHCxiRKoG9woM85dnGrxbUbd-5IXyMKO7syqyZXLgHFd8GQJkiMvvp1eHI9N32iJqMG-l_aFgSeXMbcqkFFcjuT22djM93dmKs_RBb58kppS3CadOPHSt5_tApCxAq0wgTfYQng3OkV_uVRdjIYftyfnHW3nF2vWz4hZBoX-YhmF6gDhXtN9dNTnU4QpHB7sGCecpjYgT8ypV-u5isvFrujHl3tl4.bin"
},
"httpStatusCode": 200
} ....
]
}
}
This comes back as a 200OK without any response body which is expected.
After that I check the upload status and which comes back with a code of SERVER_ERROR and I'm not able to create a post with the asset id of the uploaded asset.
Response from checking asset status https://api.linkedin.com/v2/assets/C5605AQFnYcNsf7K5Yw
{
"recipes": [
{
"recipe": "urn:li:digitalmediaRecipe:feedshare-video",
"status": "SERVER_ERROR"
}
],
"serviceRelationships": [
{
"relationshipType": "OWNER",
"identifier": "urn:li:userGeneratedContent"
}
],
"mediaTypeFamily": "VIDEO",
"created": 1616458317042,
"id": "C5605AQFnYcNsf7K5Yw",
"lastModified": 1616458454711,
"status": "ALLOWED"
}
Request to create a UGC post with the asset https://api.linkedin.com/v2/assets
{
"author": "urn:li:organization:71736744",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"media": "urn:li:digitalmediaAsset:C5605AQFnYcNsf7K5Yw",
"status": "READY",
"title": {
"attributes": [],
"text": "Sample Video Create"
}
}
],
"shareCommentary": {
"attributes": [],
"text": "Some share text"
},
"shareMediaCategory": "VIDEO"
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
Response to the request
{
"serviceErrorCode": 0,
"message": "Resource assets does not exist",
"status": 404}
The only thing I can think of is since I don't have a metadata value when completing the upload I'm not able to use the video asset in UGC posts. Anyone encountered a problem similar to this?
Further Investigations
On further investigation the example from the API docs doesn't return a metadata field either. So this is what I think might be happening
I'm not uploading the file chunks correctly and the metadata field isn't required for completing the upload.
The API has a bug in it which prevents it from returning the metadata field when registering a multipart upload.
Figured it out, when using the slice method to break your file up into chunks it needs to be file.slice(firstByte, lastByte + 1)
It also seems that the metadata value from the register upload request isn't need to complete the upload.

LinkedIn creative ad with an image and a call-to-action

Using LinkedIn APIs I'm trying to create a Creative Ad with an image and a call-to-action button like the following example from campaignmanager:
I tried many possibilities using Asset and Share APIs to create a dark Share but i'm unable to create a Creative with an image and a call-to-action button. The example in the documentation doesn't say if I should use ARTICLE or RICH shareMediaCategory. Setting landingPageUrl like in this example seems to have no effect when using from a Creative Ad.
I successfully created a video Creative Ad with a call-to-action but the new UgcPost API is only supporting AdDirectSponsoredContent for video.
Does somebody know how to do it?
Thank you
I found a workaround by creating first a RICH dark share that accepts an uploaded asset urn in the entity field:
POST https://api.linkedin.com/v2/shares
{
"owner": "urn:li:organization:1234",
"agent": "urn:li:sponsoredAccount:5678",
"subject": "An ad title",
"text": {
"text": "An ad title"
},
"content": {
"contentEntities": [
{
"entity": "urn:li:digitalmediaAsset:ABCD",
"entityLocation": "https://stackoverflow.com"
}
],
"shareMediaCategory": "RICH"
},
"distribution": {
"linkedInDistributionTarget": {}
}
}
Then I create a 2nd ARTICLE dark share with the thumbnails info recovered from the 1st dark share plus the "call to action" button:
POST https://api.linkedin.com/v2/shares
{
"owner": "urn:li:organization:1234",
"agent": "urn:li:sponsoredAccount:5678",
"subject": "An ad title",
"text": {
"text": "An ad title"
},
"content": {
"contentEntities": [
{
"entityLocation": "https://stackoverflow.com",
"thumbnails": [
{
"resolvedUrl": "https://media-exp1.licdn.com/dms/image/ABCD/feedshare-shrink_1280/..."
}
],
"title": "Click here to learn more!",
"landingPageUrl": "https://stackoverflow.com",
"landingPageTitle": "LEARN_MORE"
}
],
"shareMediaCategory": "ARTICLE"
},
"distribution": {
"linkedInDistributionTarget": {}
}
}

Publish on LinkedIn company page

So I'm trying to publish a post on a company page using the ugcPosts API.
When I'm doing in to a personal account it works great but when I'm doing it for a company page I get status "201 Created" but it doesnt appear on the company page.
I'm using the test company page https://www.linkedin.com/company/devtestco/
The user I'm authenticated with has permissions:
- r_liteprofile
- r_emailaddress
- w_member_social
- w_organization_social
- r_organization_social
I make the call to:
https://api.linkedin.com/v2/ugcPosts
with the body
{
"author": "urn:li:organization:2414183",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {
"text": "A share comment"
},
"shareMediaCategory": "ARTICLE",
"media": [
{
"status": "READY",
"description": {
"text": "A description"
},
"originalUrl": "https://linkedin.com/",
"title": {
"text": "A title"
}
}
]
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
Am I doing something wrong? Is there any problems with https://www.linkedin.com/company/devtestco/ test company page? Is there another company page used for testing?
Like I said, I recieve "Created" response but where is it then? The devtestco page doesnt have any posts at all which I find weird since I cant be the only one using it.
So I tested with a "real" company page instead and it worked, so there seems to be something weird with the page https://www.linkedin.com/company/devtestco/

Dialogflow V2 Messenger Integration with Multiple Messages

I am trying to send to multiple messages within one Webhook call to Dialogflow, which shall be passed to Messenger. Right now my Webhook responds with a malfunctioning JSON body:
{
'fulfillmentText': "Text",
'fulfillmentMessages': [{
"platform": "facebook",
"text": [{
"text": "Text"
}]
}],
'source': "facebook"
}
When I test the Webhook via Messenger I see the is typing symbol, but never receive the Text message. While testing the same Webhook from the Dialogflow Console I get
Webhook execution successful
returned. I guess I am missing some JSON fields to tell Dialogflow in which format it has to send the JSON two the Messenger API. Anybody having any clues on how to solve this issue?
Edit:
My latest not working trial...
{
"fulfillmentText": "Hola!",
"fulfillmentMessages": [
{
"text": {
"text": [
"Title: this is a title"
]
},
"platform": "FACEBOOK"
},
{
"text": {
"text": [
"Title: this is a title"
]
},
"platform": "FACEBOOK"
}
]
}
If you're only sending text you only need to provide a string to the fulfillmentText and don't have to provide the fulfillmentMessages attribute.
If you do provide a fulfillmentMessages attribute with the target platform Dialogflow will send your payload to Facebook. In this case, where the payload is invalid, no message will actually be surfaced in Facebook. remove the fulfillmentMessages attribute of the response JSON and your bot should respond.
If you'd like to add a card to your response you can send the following response:
{
"fulfillmentMessages": [
{
"platform": "FACEBOOK",
"card": {
"title": "Title: this is a title",
"subtitle": "This is an subtitle. Text can include unicode characters including emoji 📱.",
"imageUri": "https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png",
"buttons": [
{
"text": "This is a button",
"postback": "https://assistant.google.com/"
}
]
}
}
]
}
EDIT: If you want to send multiple messages you can do so by sending a response like this (this JSON will send two identical cards but you can change the message type (card/text/etc) based on this documentation):
{
"fulfillmentMessages": [
{
"platform": "FACEBOOK",
"card": {
"title": "Title: this is a title",
"subtitle": "This is an subtitle. Text can include unicode characters including emoji 📱.",
"imageUri": "https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png",
"buttons": [
{
"text": "This is a button",
"postback": "https://assistant.google.com/"
}
]
}
},
{
"platform": "FACEBOOK",
"card": {
"title": "Title: this is a title",
"subtitle": "This is an subtitle. Text can include unicode characters including emoji 📱.",
"imageUri": "https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png",
"buttons": [
{
"text": "This is a button",
"postback": "https://assistant.google.com/"
}
]
}
}
]
}
I mailed the Dialogflow support about this issue and it turns out that it is currently not possible to send multiple messages from a webhook.
Hi,
At this point, it's not possible to send sequential messages directly
from webhook. However, if you are using one of our one-click
integrations that support rich messages, you can invoke intents in
which multiple messages are defined from webhook through an event as
described at
https://dialogflow.com/docs/events#invoking_event_from_webhook.
Let me know if you have any questions.
Regards, Ankita from Dialogflow

Is it possible to filter pact broker overview page/verification overview by tag?

The pact broker overview page (the index page) displays the verification status of each pact which is very useful. Is it possible to filter this view, by a query parameter or such, so that I can see the verifications for a certain tag? I would like to use this to have an overview of all the prod-tagged pacts and their verifications to make sure that all prod-pacts have been verified when making releases of components.
If not I'm contemplating having a separate pact broker instance for the prod pacts.
Thanks!
It's totally doable. It's just a matter me (or someone else) having the time to do it. I've raised an issue for it here:
https://github.com/pact-foundation/pact_broker/issues/146
In the meantime, you can make your own "dashboard" by making a CI build for each prod tag. I think I may have put this on the gitter channel already.
Call /pacts/provider/PROVIDER/consumer/CONSUMER/latest/prod. Follow the pb:consumer-version relation, then follow the pb:latest-verification-results-where-pacticipant-is-consumer relation.
You'll get this.
{
"success": true,
"providerSummary": {
"successful": [
"B"
],
"failed": [],
"unknown": []
},
"_embedded": {
"verificationResults": [
{
"providerName": "B",
"providerApplicationVersion": "2",
"success": true,
"verificationDate": "2017-10-09T12:34:17+08:00",
"_links": {
"self": {
"title": "Verification result",
"name": "Verification result 2 for Pact between A (v1) and B",
"href": "http://localhost:9292/pacts/provider/B/consumer/A/pact-version/7954fb780aa0db0ea451db4c3c1012fb7f0e1eb4/verification-results/2"
},
"pb:pact-version": {
"title": "Pact",
"name": "Pact between A (v1) and B",
"href": "http://localhost:9292/pacts/provider/B/consumer/A/version/1"
}
}
}
]
},
"_links": {
"self": {
"href": "http://localhost:9292/verification-results/consumer/A/version/1/latest",
"title": "Latest verification results for consumer A version 1"
}
}
}
I'll try and prioritise adding the tagged pacts to the UI.

Resources