Does artifactory keep a record of downloads? - artifactory

I've looked in the jfrog docs unsuccessfully for this. It would be really nice to see how many folk have downloaded something we uploaded to our artifactory.

You can view the download count from UI as well as from REST API.
UI > Navigate to artifact from tree view > General tab > Number of downloads will be visible.
Using REST API.
curl -u admin -X GET "https://myartifactory.jfrog.io/artifactory/api/storage/my-repository/org/jfrog/0.1/myjar-0.1.jar?stats"
This will result the following output.
{
"uri" : "https://myartifactory.jfrog.io/artifactory/api/storage/my-repository/org/jfrog/0.1/myjar-0.1.jar",
"downloadCount" : 11,
"lastDownloaded" : 1666979645447,
"lastDownloadedBy" : "admin",
"remoteDownloadCount" : 0,
"remoteLastDownloaded" : 0
}

Related

Remove Subscription line items via API for items that no longer exist in WooCommerce Store

Background:
I have about 1000 subscriptions that I need to run through and delete line items. Woocommerce has somehow allowed us to delete products that are tied to subscriptions, meaning there are now up to 1000 subscriptions with products in them which no longer exist.
This creates many problems for the subscribers, such as not being able to manually renew, as they get errors for the products that do not exist.
I can delete them manually, where I will click into a subscription and remove 10+ items 1 by 1 per subscription. This will take way too long manually.
What I’m trying to do:
I want to run through all the subscriptions 1 by 1, look through the line items, and remove any line items where the “parent_id” is 0.
What I have tried so far:
I’ve tried many variations of the JSON below (also both with and without the 'subscription' line), and this is where I am at currently.
See API info here
See line item info here
NOTE: I get no error messages, the request reponse is 200. But no items are removed...
curl -X PUT https://example.com/wp-json/wc/v3/subscriptions/{subscriptions_id} \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"subscription":{
"line_items":[
{
"product_id":0,
"quantity":0
}
]
}
}'
What I would like help with:
At the very least to know if I'm on the right track, or if what I'm trying to do is even possible. But ideally, to point me in the right direction, or help fix up my API request.
Thanks in advance!!
NOTE 2:
I can't use AutomateWoo for this, as AutomateWoo requires the product to exist before you can select it / remove it.
Figured it out...
So you need to refer to the line item by using 'id' and not 'product_id' if you want to remove it. Because the 'id' is never empty (even if the product doesn't exist), I had to build a complex automation using different API endpoints.
You need to
list all subscriptions
have automation run through line items per subscription, only allowing ones with product_id = 0 to pass
run the proper JSON to delete the line items referencing the 'id'
{
"line_items": [{
"id": 18756,
"quantity": 0
}]
}

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

Opening Alfresco document from Solr4 Search result

I'm using Alfresco 5.1 community Edition with Solr4 configured as Search Service and Transaction queries configured as Hybrid (Solr & DB)
When I do a search in Solr GUI from the below URL
Solr Query GUI: https://localhost:8443/solr4/#/alfresco/query
I get the search results in the below format with some ID & other info.
Solr Search Result (Results JSON truncated for readability)
{
"responseHeader": {
"status": 0,
"QTime": 25,
"params": {
"q": "testing",
"defType": "dismax",
"qt": "",
"indent": "true",
"wt": "json",
"_": "1476349027637"
}
},
...
"docs": [
{
"id": "_DEFAULT_!8000000000000040!80000000000008e3",
"_version_": 0,
"DBID": 2275
},
{
"id": "_DEFAULT_!8000000000000072!8000000000000902",
"_version_": 0,
"DBID": 2306
},
{
"id": "_DEFAULT_!8000000000000040!80000000000008ea",
"_version_": 0,
"DBID": 2282
},
{
"id": "_DEFAULT_!800000000000000b!80000000000008ef",
"_version_": 0,
"DBID": 2287
},
{
"id": "_DEFAULT_!8000000000000071!80000000000008f0",
"_version_": 0,
"DBID": 2288
},
{
"id": "_DEFAULT_!8000000000000025!80000000000008eb",
"_version_": 0,
"DBID": 2283
}
]
},
"processedDenies": false
}
I'm trying to build a UI where in these search results displayed, a user can click through to retrieve the respective document in Alfresco. Below is the Alfresco API I use to retrieve content from Alfresco.
Alfresco API URL to open a Document : http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom/content?id=
A sample Alfresco document ID looks like the one shown below. I don't get such ID returned in Solr4 search results.
Sample Document Id:
7edf97f4-43cf-4fe5-8099-85608776d159
Questions:
1) What is the ID returned by Solr4 ?
2) How do I get the relevant Alfresco document ID to be able to retrieve the same from the search result ?
EDIT:
Some background about my requirement to use Solr directly
Alfresco will be used to create documents based on some templates by interal users (business content administrators from Intranet typically). We've a front end web app (customer facing) which will have a Search section. When users perform a search operation with some keywords (Typically full text search), we would be invoking Solr API to search content in the documents created by Business Admins and the same results would be displayed on the Front end of Web app. When users clicks on the respective search results, the document content would be retrieved from Alfresco & displayed on the Front end webapp.
Thanks in advance.
It would be much easier to implement it as Alfresco Web Script.
With Web Scripts, you can either build your own RESTful interface
using light-weight scripting technologies such as JavaScript and
Freemarker.
Using web script you can access search root object:
search - org.alfresco.repo.jscript.Search -
Root object providing access to the various Alfresco search interfaces
such as FTS-Alfresco, Lucene, XPath, and Saved Search results
Your REST web script may be available to every user but run as admin:
<webscript>
<shortname>My Rest Query</shortname>
<url>/api/my/query</url>
<format default="json">argument</format>
<authentication runas="admin">guest</authentication>
<transaction allow="readonly">required</transaction>
</webscript>
There are many tutorials...
1) The ID returned by Solr is probably the ID of the indexed document in Solr. You can't use it with Alfresco.
2) It seems that Solr returns the DBID of the nodes. DBID is the property sys:node-dbid from aspect sys:referenceable defined in the file systemModel.xml and which refers to the database id of the node.
You can build an Alfresco repo webscript which takes this DBID as parameter and returns the document.
But as imagine said, you'd better directly ask Alfresco to execute your Solr query. It would return a list of documents with all the metadata you need, including the download URL of each document.
Adding a partial answer to your 2nd question because locating this info was hard and took quite some time. (2. How do I get the relevant Alfresco document ID to be able to retrieve the same from the search result ?)
To find the document associated with that DBID, you can use the following search syntax:
Go to Admin Tools -> Node Browser
Change query type to lucene
Enter the following search term: #sys\:node-dbid:THE_DBID_YOU_WANT_TO_FIND
For example, looking at our local solr4 error report:
{
"responseHeader":{
"status":0,
"QTime":0,
"params":{
"q":"ERROR*"}},
"response":{"numFound":2,"start":0,"docs":[
{
"id":"_DEFAULT_!800000000000008c!8000000000002289",
"_version_":0,
"DBID":4499},
...
To find that document, search for: #sys\:node-dbid:4499
You can add quotes around the numeric DBID - it works with and without them.
The '#' and the first backslash '\' (escaping the first colon) are REQUIRED - the query breaks if these are removed and an error will be logged in catalina.out.
The second colon MUST NOT include a backslash escape - it is NOT an error (nothing in the log) but no result will be found.
If necessary change the search scope from workspace://SpacesStore to archive://SpacesStore to locate docs that have been deleted.
You can join the DBID's as shown below to find them all at once (at least those in the same spaces store):
#sys\:node-dbid:1234 OR #sys\:node-dbid:2345 OR #sys\:node-dbid:...

How to handle CollectionFS saving failures

I'm using collectionFS and in particular the S3 storage adapter.
Most files get uploaded perfectly fine and I can download them afterwards with no problem.
Occasionally I get a file that appears to load fine (Files.insert(blob,callback) returns to the callback with no error) but later when I go to download them fsFile.url() returns null.
https://github.com/CollectionFS/Meteor-CollectionFS#after-the-upload says:
If any storage adapters fail to save any of the copies in the designated store, the server will periodically retry saving them. After a configurable number of failed attempts at saving, the server will give up.
But there is no callback that I'm aware of for such a failure. Furthermore when looking at fsFile.uploadProgress() I get 100%.
The basic problem is thus that during upload everything looks fine and my app only detects a problem when trying to download the file.
Is there a way to detect an upload failure in the storage adapter?
What else would fsFile.url() returning null be symptomatic of?
Here's an example of one of these broken fsFile objects in mongodb:
{
"_id" : "uqAYajqCv68HmEJhu",
"original" : {
"updatedAt" : ISODate("2015-03-16T23:04:37.200Z"),
"size" : 699072,
"type" : ""
},
"chunkSize" : 2097152,
"chunkCount" : 0,
"chunkSum" : 1,
}
On the new version of FScollection, there was integrated 3 events on the server side, stored,uploaded and error.
Images.on('error', function (fileObj) {
console.log("The " + fileObj + " with the _id " + fileObj._id " + just get an error when uploading")
});
There is not documentation about this, since raix and aldeed clean the README.

fetching all the Restaurants, supermarkets, malls etc. nearby using the Google Maps Api

I'm new in iPhone Development. I'm creating an application in which i need to fetch all the Restaurents, supermarkets, malls etc. in the nearby location using GoogleApi. Im using following link to find the venue:
https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&radius=500&types=grocery_or_supermarket&sensor=true&key=AIzaSyAiFpFd85eMtfbvmVNEYuNds5TEF9FjIPI
But I'm getting the following message:
"html_attributions" : [],
"results" : [],
"status" : "REQUEST_DENIED"
Please help.
Any solution will be appreciated.
Thanks in advance.
"Access denied" is coming because the key(AIzaSyAiFpFd85eMtfbvmVNEYuNds5TEF9FjIPI) you are using is not valid.
You have to register your project on on Google and have to generate unique key from this link.replace the generated key with the key in your link, then this will work fine.
If you have any other query let me know.

Resources