How to use api edit phabricator repository URI - phabricator

I want to add repository URI and set it to observe mode, so I tried to change default URI I/O mode from Read/Write to No IO. I tried diffusion.uri.edit, in repository key description, it said:
This transaction type must be present when creating a new URI and must
not be present when editing an existing URI.
I tested it with web conduit/method/diffusion.uri.edit. In transactions, I use
[
{"type": "uri","value": "ssh://git#05.mm.net/diffusion/TESTPROCESS/test-process.git"},
{"type": "io","value": "none"}
]
It report Validation errors:
When creating a repository URI, you must specify which repository the
URI will belong to.
I also tried add repository key such as
[
{"type": "uri","value": "ssh://git#git.missfresh.cn:test/test-process.git"},
{"type": "io","value": "none"},
{"type": "repository","value": "PHID-REPO-c7jajliasqtxoclryfim"}
]
It will create a new URI. What's the correct value for diffusion.uri.edit?

I found the answer. The transactions parameters are correct, but objectIdentifier is needed also, its value is the URI ID.

Related

What is the difference between using getDownloadUrl() vs. making the object public?

Once someone shares the getDownloadUrl() link with the token parameter, anyone can access the object, the same as they would a public object. Is the only difference that that token can be revoked / changed? Or is it also easier to scrape / list objects in the bucket if they are public and don't require a token? I'm trying to understand the purpose of having a non expiring token.
If you are referring to security rules by "making public" (or making the bucket public) then that just states who can request the download URL. If the bucket is private or the security rules don't allow anyone to access it, then they cannot request the download URL. However is by chance the manage to get the correct token and URL then they will be able to access that file.
To summarize, if someone who is not authorized to get a file, they would have to rely on someone who can request the donwload URL to access it (they cannot directly get one themselves).
If you make set permissions of your bucket to "Public to internet" from Google Cloud console, then if you visit root URL of the bucket you can see the contents:
By default, Firebase Storage's permission is set to "Not public" so no worries about that.
Edit:
If you allow list (requires rules_version="2") then contents of your directory can be listed similar to this:
{
"prefixes": [],
"items": [
{
"name": "Files/-Mf1kIafT6BnVnhgDQT2.pdf",
"bucket": "[PROJECT_ID].appspot.com"
},
{
"name": "Files/-Mf1pmCQMBNEdkQAnUjk.pdf",
"bucket": "[PROJECT_ID].appspot.com"
}
]
}
Reference: Granular Operations

Alexa Skill Developers Reference-Based Catalog Management API

This doc says "With the Reference-Based Catalog Management API, you can create a custom slot type that references an external data source to get the slot type values. This API allows you to create and maintain a catalog of slot type values independent of your Alexa skill."
However as you dig into it, it doesn't provide some needed details on how to actually setup the catalog on an endpoint like s3.
While this resource was provided as an answer in this similar question, it actually refers to content catalogs (like music playlists), not the Reference-Based Catalog Management API, so I assume that was in error and it is not applicable.
So, for the Reference-Based Catalog Management API: The docs say it needs to be in JSON format, and offers ingredients.json as an example. However I used this directly, and it fails (see below). Also, it does not describe what the format should be to include synonyms. Please describe this.
I can successfully create the catalog with '/v1/skills/api/custom/interactionModel/catalogs/' and get a catalogId in return. However, creating the catalog version via '/skills/api/custom/interactionModel/catalogs/{catalogId}/versions' fails. I get "Website Temporarily Unavailable" when I issue the POST.
Here's the request body structure that I'm including with that post:
data: {
"source": {
"type": "URL",
"url": "https://s3.amazonaws.com/..../ingredients.json"
},
"description": "test S3 bucket"
}
Also, does the S3 endpoint have to be made public? I tried it both ways, didn't seem to matter. If it does have to be public though, how did you handle security?
Thanks for the help.
While the API call fails, I did get this to work using the CLI approach.
ask api create-model-catalog-version -c {catalogID} -f {filename}
The file should be JSON with the following structure:
{
"type": "URL",
"url": "[your catalog url]"
}
It remains an open question how to get the API approach to work, so any answers appreciated. Maybe it is a bug, because I specify the exact same 'source' definition in the data structure of the API call as I do in the JSON file used by the CLI command.
Here's what I learned as I got it to work with the CLI:
Yes, the S3 endpoint must be made public in order for the create-model-catalog-version job to succeed. This strikes me as a problem, would like to see the ability to wrap some security around these endpoints.
Here is the format of the JSON that you will want to use, including the use of synonyms which is not described in the official Amazon example. Note that you don't have to include an ID as shown in that example.
{
"values": [
{
"name": {
"value": "hair salon",
"synonyms": [
"hairdresser",
"beauty parlor"
]
}
},
{
"name": {
"value": "hospital",
"synonyms": [
"emergency room",
"clinic"
]
}
},
]
}

here api request error --- Invalid credentials

I have a 90-day trial and I am registered at (Evaluation 2018-06-29).
But when I request with my correct copied app id and app code I get the below error.
{
"response": {
"_type": "ns2:RoutingServiceErrorType",
"type": "PermissionError",
"subtype": "InvalidCredentials",
"details": "This is not a valid app_id and app_code pair. Please verify that the values are not swapped between the app_id and app_code and the values provisioned by HERE (either by your customer representative or via http://developer.here.com/myapps) were copied correctly into the request.",
"metaInfo": {
"timestamp": "2018-08-15T18:52:35Z",
"mapVersion": "8.30.86.153",
"moduleVersion": "7.2.201832-36299",
"interfaceVersion": "2.6.34"
}
}
}
Can anyone help, especially someone from here api developer support team?
Go into your account projects and add a new project explicitly for the Freemium plan. Then you should be able to generate a new JavaScript/REST App ID and App Code. If you are using one of the mobile SDKs you would generate a new id / code there as well.
(1) Copy and Paste
I'm not certain this is what may be happening for you, but one of my codes had a leading underscore and it was very easy to copy and paste it incorrectly into my source code.
(2) Domain Protection
Also make sure that if you checked "Secure app credentials against a specific domain" that you are calling the routing service from the same domain.
(3) Shell Interpolation
Without more detail about how you are making the calls to the routing service (curl, postman, javascript, ios, android, etc.) it may also indicate where to offer advice.
For example, if you are using curl make sure your parameters have surrounding quotes as & will be interpreted by a shell such that ?app_id=your-app-id&app_code=your-app-code is not interpreted properly. That could generate the response you saw as the shell took your app_code parameter away before curl could make the request only passing the app_id.

Apple App Site association not working

App Search API Validation Tool of "Apple" is not validating my domain.
https://search.developer.apple.com/appsearch-validation-tool
I am using universal links but "Link to Application" is showing me "Error".(http://www.awesomescreenshot.com/image/1719847/330979a43c4c6b2766da1e703447ee04)
Here is my "apple-app-site-association" file code.
{"applinks": {"apps": [],"details": {"XXXXXXXXXX.com.streatmanagement.threadshare": {"paths": ["*"]}}}}
Can someone please solve my query or send the sample of "apple-app-site-association" valid code?
Apple's API validation tool compares your website's association file to a store listing. If your app is not yet publicly available the error you listed will be displayed.
Your apple-app-site-association has a small typo where you specify the details (it should be an array). I also assume you're replacing the XXXX's with your app ID.
{
"applinks": {
"apps": [],
"details": [
{
"appID": "APPID.BUNDLEID",
"paths": [ "*" ]
}
]
}
}
Even if you get this error from Apple's validation tool, you can test Universal links. If your Universal Link does not work on your test device you need to inspect the device logs when you fresh install it and make sure your apple-app-site-association is available at the root of your site via https with no redirects. Sometimes there is issue if the content-type is not application/json (but the file name should remain exactly apple-app-site-association).

Artifactory REST API: File List

I'm trying to seach for an artifact using "File List" API http://server:port/api/storage/folder1/folder2?list&deep=1&depth=3&listFolders=1
The actual artifact is inside the sub-folder(lets say, folder3) of folder2. But the response for this api call is like,
{
"uri": "some uri"
"created": "some time stamp"
"files": [ ]
}
file list is empty in the response, but there are many files inside folder 3.
One reason for this can be lack of permissions. The file list API will only returns items which the requesting user have read permission for.
In your case, since the same user is able to get the artifact info for /folder1/folder2/folder3/filename but not the file list for /folder1, there might be a permission target which prevents the user from reading the content of folder1 of folder2. This can happen if a permission target has an exclude pattern, for example folder1/*.
If you have Artifactory admin rights, you can check this from the UI by looking at the effective permissions tab for folder1, folder2, folder3.

Resources