Folder/File smart link enable/disable call in Box V2 API - box-api

Recently an article on the box dev blog talked about an update in the V2 API functionality. http://developers.blog.box.com/2012/07/13/more-v2-updates/.
I am specifically talking about the share link for file/folders. The article says the API can be used to create/delete share links and also change the permission.But i do not see any such API on the http://developers.box.com/docs page.
Does anybody have any idea about this discrepancy? Is this available now in V2 or not?

Smart links are treated as an attribute of a folder or file and can be created by updating the metadata about the folder or file. This is done through the PUT method. You can see this here for files and here for folders.
For example, if you wanted to enable a shared link for a file you would make this call using cURL:
curl https://api.box.com/2.0/files/FILE_ID \
-H "Authorization: BoxAuth api_key=API_KEY&auth_token=AUTH_TOKEN" \
-d {"shared_link": {"access": "open"}} \
-X PUT

Related

Shared drives option "driveMembersOnly" in G-suite is not applied via API request

I have some problem with shared drive in google drive API by using g-suite.
So, I set up on g-suite console options which one restrict sharing by link for shared drive users. That means when you create shared drive it's default parameter for option driveMembersOnly is true.
But when you sent API request for create shared drive with body - ("restrictions": {"driveMembersOnly": false }) - disk creating with opportunity shared files via links, so everything work, i tested it in august 2019.
But now - it's just don't work. I think something is changed and i need fix my code, but I use "try it" section on https://developers.google.com/drive/api/v3/reference/drives/create page, try to pass any parameter in "restrictions" section - and API just ignore this params.
So, I don't know. Maybe it's a bug? Or maybe google change console options behavior and it's overwriting this parameter for all my API requests.
Maybe some one faced with such problem?
Support of gsuite don't help with API problems.
And this is the request:
curl -X POST "https://www.googleapis.com/drive/v3/drives?requestId=123" -H "accept: application/json" -H "Authorization: bearer TOKEN" -H "content-type: application/json" -d "{ \"restrictions\": { \"driveMembersOnly\": false }, \"name\": \"shared drive name\"}"

How to remove .html extension in URL on google cloud platform (storage bucket) hosted site? [duplicate]

I'd like to let website users load userProfile.html when they request www.website.com/userProfile (without .html).
There is nothing about that in docs.
You can serve HTML content without a .html suffix. It's important to set the content-type though. For example, with gsutil:
gsutil -h "Content-Type:text/html" cp /path/users/userProfile \
gs://www.website.com/userProfile

Enabling and Disabling Storage Plugin

I am running Apache Drill in Window 8.1 OS, having latest version of Drill (1.7).
I want to enable or disable storage plugin programatically (using C# code).
Is there any way to do so.?
You can update drill plugin via REST API.
I am taking MongoDB plugin as an example.
Enable
curl -X POST -H "Content-Type: application/json" -d '{"name":"mongoPlugin", "config":{"type":"mongo","enabled":true,"connection":"mongodb://localhost:27017/"}}' http://localhost:8047/storage/mongoPlugin.json
Change "enabled" to false to disable it.
Disable
curl -X POST -H "Content-Type: application/json" -d '{"name":"mongoPlugin", "config":{"type":"mongo","enabled":false,"connection":"mongodb://localhost:27017/"}}' http://localhost:8047/storage/mongoPlugin.json
Check drill docs for more details.
You already answered about creating plugins using C#. Just change payload as mentioned above.
For Enabling or Disabling Storage Plugin in Window Environment. First we have to download curl.exe file from Download Curl
. Set the path of curl.exe file in Environment Variable:-
Follow these steps:-
Download curl zip
Extract the contents (if you have downloaded the correct version you should find curl.exe)
Place curl.exe in a folder where you keep your software (e.g. D:\software\curl\curl.exe)
To run curl from the command line
a) Right-hand-click on "My Computer" icon
b) Select Properties
c) Click 'Advanced system settings' link
d) Go to tab [Advanced] - 'Environment Variables' button
e) Under System variable select 'Path' and Edit button
f) Add a semicolon followed by the path to where you placed your curl.exe (e.g. ;D:\software\curl).
Now Open Command Prompt and run following command:-
For Disabling Storage Plugin:-
curl http://localhost:8047/storage/DemoMySQl/enable/false
For Enabling:-
curl http://localhost:8047/storage/DemoMySQl/enable/true
Note:- DemoMySQl is storage plugin name.

Basic Authentication not working for creating new post using WP REST API 2.0

I'm trying to create a new post using cUrl on my Wordpress 4.3.1 site with below plugins:
WP BASIC Auth 1.1.3
WP REST API 2.0-beta4
I've added below code to my htaccess.conf file, because this thread told me so:
<IfModule !php5_module>
Define USE_PHP_FPM
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
Type in command line:
curl --data-binary "#updated-post.json" -H "Content-Type: application/javascript" --user "my_admin_user_name":"my_admin_password" http://www.mysite.nu/wp-json/wp/v2/posts
Contents of updated-post.json:
{
"title": "Hello Updated World!",
"content_raw": "<p>Howdy updated content.<\/p>",
"date": "2013-04-01T14:00:00+10:00"
}
Error code:
[{"code":"rest_forbidden","message":"You don't have permission to do this.","data":{"status":403}}]
The GET request does work. Some help would be much appreciated!
I found that the problem is in the Basic Auth plugin. WP-API guys recommend using their own plugin and this solution works for me.
Deactivate all activated basic auth plugins in your WordPress dashboard
On the machine your WordPress is running go to the plugin folder
Run
git clone https://github.com/WP-API/Basic-Auth.git
Go to your WordPress admin dashboard, plugins page. JSON Basic Authentication should be in the list. Activate it.
Now creating a record via POST request should work.

Programmatically change the repository URL of a Hudson job

Is there a way to change the repository URL of a Hudson job using the Hudson CLI API?
There is no way to change the repository URL using the Hudson CLI. However there is a workaround that can be automated with little effort.
Workaround:
We can use cURL to download the config.xml of the job using the following command (note that in order to run cURL commands you have to setup cURL):
curl -X GET http://your-hudson-server/job/TheNameOfTheJob/config.xml -o localCopy.xml
The configuration file will contain something similar to this (depending on the Version Control used):
<scm-property>
<originalValue class="hudson.scm.SubversionSCM">
<locations>
<hudson.scm.SubversionSCM_-ModuleLocation>
<remote>https://your-repository</remote>
The value of the <remote> tag is the repository url (also check the credentials for the new repository).
There are several cURL ways to submit the modified version of config.xml back on the server. One way is:
curl -X POST http://your-hudson-server/job/TheNameOfTheJob/config.xml --data-binary "#newconfig.xml"