Filepicker.io: Pagespeed and remove query strings from static resources - pagespeed

So after successful upload of images via Filepicker we access the images at the given URL and in most places call convert with some parameters passed in. We use Amazon S3 Cloudfront as a CDN in front of filepicker as filepicker states convert is not meant for high traffic sites - fair enough.
The problem that I'm experiencing with convert though is that it's nailing our Page speed and we are getting the message "remove query strings from static resources" for all our Filepicker files.
The reason for the warning is "Resources with a "?" in the URL are not cached by some proxy caching servers."
Is there a way to avoid using query parameters while still retaining the capability of convert function?
I would love to improve my pagespeed but can't see how to fix this particular issue while still using Filepicker.

Similar to REST convert there is javascript filepicker.convert method which return new file link.
var blob = {
url: 'https://www.filepicker.io/api/file/H7KYuWy1S3e1qvG2M66i',
filename: 'customers.jpg',
mimetype: 'image/jpeg',
isWriteable: false,
size: 629454
};
filepicker.convert(
blob,
{
width: 200,
height: 200
},
function(converted_Blob){
console.log(converted_Blob.url);
}
);
Another solution would be to store the conversion REST results.
Curl example:
curl -X POST -d url="https://www.filepicker.io/api/file/H7KYuWy1S3e1qvG2M66i/convert?w=100" "https://www.filepicker.io/api/store/S3?key=yourApiKey&container=yourContainerName"
Sample response:
{"container": "yourContainerName", "url": "https://www.filepicker.io/api/file/383MY1piRQqTg1N9K5tw", "filename": "IMAG0038.jpg", "key": "XNeqfiMaRlm4OMAQIJ9y_IMAG0038.jpg", "type": "image/jpeg", "size": 1763}
In this way you can create a server-side conversions

Related

Issues while expanding URNs in versioned creatives response

We are migrating our APIs from unversioned to versioned, and having an issue while trying to get assets data from creatives endpoint.The response has reference to a post, but we are unable to use the expand URNs concept and get the inner media details of the Post URN. Is there a different approach we need to follow here?
I've read through all the migration documents and the response decoration document is also pointing to v2 endpoint and projection parameters, instead of using rest endpoint and fields parameter. Document reference.
Previous Request
GET -
https://api.linkedin.com/v2/adCreativesV2?ids[0]=181794673&projection=(results(*(variables(data(com.linkedin.ads.SponsoredVideoCreativeVariables(userGeneratedContentPost~(specificContent(com.linkedin.ugc.ShareContent(shareCommentary,media(*(media~:playableStreams(),title)))))))))))
This request gets us the media details of the creatives without making multiple calls.
Current Request
GET - https://api.linkedin.com/rest/creatives?ids=List(urn%3Ali%3AsponsoredCreative%3A181794673)&fields=(results(*(content(reference~($URN)))))
I am looking at the response I got from https://api.linkedin.com/rest/creatives?ids=List(urn%3Ali%3AsponsoredCreative%3A181794673) and trying to create the fields request. But no luck yet and getting the below error.
{
"status": 400,
"code": "ILLEGAL_ARGUMENT",
"message": "Invalid projection parameter: (results(*(content(reference~($URN)))))"
}
But when tried with projection in place of fields I got a response
{
"results": {
"urn:li:sponsoredCreative:181794673": {
"content": {
"reference": "urn:li:ugcPost:6905584391779950593",
"reference!": {
"message": "Not enough permissions to access deco: ugcPosts.BATCH_GET.20230101",
"status": 403
}
}
}
}
}
Can someone help me getting the data similar to how we got it before, without making external calls? Otherwise I think I have to be making calls to Creatives -> Posts -> Video, Image, Share etc endpoints

Windchill REST API endpoint to fill BOM from file

We are developing an internal project to use the Windchill OData REST API to fill the eBOM for a given part. What we are trying to do here is to read data from another software we have to get the BOM info and send it to the part in windchill. But we cannot find an endpoint in servlet/odata to do it.
We guess the idea is to replicate the manual process. So we already know how to create, check out and check in a part. However we still cannot find an endpoint to modify the part and add the eBOM.
We know PartList, PartListItem, GetPartStructure in the PTC Product Management Domain. But these are GET endpoints and are only useful to retrieve data, including the BOM. But we cannot use them to modify the content.
I've found the solution.
The endpoint to use is:
POST /ProdMgmt/Parts('VR:wt.part.WTPart:xxxxxxxxx')/Uses
The body of the request must contain:
{
"Quantity": 1,
"Unit": {
"Value": "ea",
"Display": "Each"
},
"TraceCode": {
"Value": "0",
"Display": "Untraced"
},
"Uses#odata.bind": "Parts('OR:wt.part.WTPart:yyyyyyyyy')"
}
Where Uses#odata.bind contains the ID of the part we want to link

IPFS uri format: https://ipfs.io/ipfs/<CID> vs. ipfs://<CID>?

Here is my test tokenURI.json file w/ the imageURI I pass to my token contract.setTokenURI():
{
"attributes": [
{
"trait_type": "location",
"value": "West Awesomeville"
},
{
"display_type": "date",
"trait_type": "created",
"value": 1535250800
}
],
"description": "My awesome NFT.",
"image": "https://ipfs.io/ipfs/QmaUXii41ESnUMxLJUoVcrEeXowz7RHcdTiumvrBmUvcwG?filename=test4.png",
"name": "NFT 1"
}
Which is the best IPFS uri form to use esp. if I want to load this NFT into Opensea?
The docs in IPFS recommend:
https://ipfs.io/ipfs/<CID>
but the docs in Opensea recommend:
ipfs://<CID>
Which form is better and why?
In the above json I'm using the first form recommended by IPFS. It works but loading into Opensea is slow/somewhat unpredictable.
The form Opensea recommends is shorter, no gateway. Would the image load faster in Opensea if I used the 2nd form?
IPFS docs: Address IPFS on the Web
Opensea docs:
If you use IPFS to host your metadata, your URL should be in the format ipfs://CID. For example, ipfs://QmTy8w65yBXgyfG2ZBg5TrfB2hPjrDQH3RCQFJGkARStJb.
The ipfs:// url is the better way. Because gateways can go down. Now the ipfs pinner that you're using (pinata.cloud?) can also go down, or you can stop paying them and they will disappear your stuff.
Opensea is not likely to care, as long as they can find your metadata / images from the uri returned by the contract they will list your thing, and there's a way somewhere to do a metadata refresh (if you do a reveal)
And if I can also suggest, it probably might be a good idea to include a way to update the baseURI in the contract just in case.

Always get “Cannot parse non Measurement Protocol hits”

I have a little Python program that other people use and I would like to offer opt-in telemetry such that can get an idea of the usage patterns. Google Analytics 4 with the Measurement Protocol seems to be the thing that I want to use. I have created a new property and a new data stream.
I have tried to validate the request and set it to www.google-analytics.com/debug/mp/collect?measurement_id=G-LQDLGRLGZS&api_secret=JXGZ_CyvTt29ucNi9y0DkA via post and send this JSON payload:
{
"app_instance_id": "MyAppId",
"client_id": "TestClient.xx",
"events": [
{
"name": "login",
"params": {}
}
]
}
The response that I get is this:
{
"validationMessages": [
{
"description": "Cannot parse non Measurement Protocol hits.",
"validationCode": "INTERNAL_ERROR"
}
]
}
I seem to be doing exactly what they do in the documentation or tutorials. I must be doing something wrong, but I don't know, what is missing. What do I have to do in order to successfully validate the request?
Try to remove /debug part in the URL. In the example you followed it is not present so it is not quite exactly the same.
we just came across the same issue and the solution for us was to put https:// in front of the URL. Hope this helps.

How can I get custom_array from Brach.io deep-links?

I have an e-commerce application and I want to share my item/cart to other users. For sharing, I am using Branch.io for creating deep-links. I am appending some custom data while creating the URL and send it to other users. Otherwise, I will keep the URL in my database for future use. Sometimes I am not able to get the data from the URL once it's created or after some days. As per the documentation of branch.io, there is no expiration for the URL. The following API I am using for creating a deep-link:
POST /v1/url HTTP/1.1
Host: api2.branch.io
Content-Type: application/json
{
"branch_key": "xxxxxxxxxxxxxxxxxxseaem3d",
"data": {
"custom_array": [
{
"item_id": "5e96f893264b7869d143f7f2",
"store_id": "5e7355deb1f5974bbd0bab18",
"items_group_id": "5e7355deb1f5974bbd0brer18"
}
]
}
}
Response:
{
"url": "https://jazzly.app.link/YDPMzhg1k7"
}
We can able to check the data is available in the URL or not using the following API.
GET /v1/url?url=https://jazzly.app.link/YDPMzhg1k7&branch_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxseaem3d
HTTP/1.1
Host: api2.branch.io
By using this API I am getting the following result. Here the custom_array is missing.
{
"data": {
"+url": "https://jazzly.app.link/YDPMzhg1k7",
"~creation_source": 0,
"~id": "801058500452495196",
"$one_time_use": false,
"url": "https://jazzly.app.link/YDPMzhg1k7"
},
"type": 0
}
This issue comes with only some links. Some links are working properly some links are not. Actually it's very helpful for dynamically open the application for IOS and Android. How I can fix this issue? Is there any parameter is missing while I am creating the deep-link URL or is there an expiration time for keeping custom data in the deep-link?
A Branchster here -
Upon checking your link https://jazzly.app.link/YDPMzhg1k7, I couldn't find any custom data associated.
To reproduce this we made API requests with your custom data and got the following link - https://jazzly.app.link/cLX6GEFk07. Further, we could read the associated link data as well -
We would suggest you recheck on the same behaviour and if the issue still persists drop an email to support#branch.io

Resources