I am using Google Chromes Advanced REST Client to try some REST calls to SharePoint and Project Server.
I managed to read the data with a simple GET. I get an XML back that has all the properties for the given object. For instance if there's a Project object, this would have a Project Name property.
<entry xmlns....
....
<m:properties>
<d:ProjectName>Test Project </d:ProjectName>
... a lot more properties ...
</m:properties>
... *some other tags* ...
</entry>
I would very much like to update this Project Name, and in the SDK I read that the Project object supports the DELETE, MERGE, PUT methods. I've read that the MERGE one is the one which allows the user to only update selected properties without taking effect on others. The Advanced REST Client however does not have a MERGE, but it has a PATCH.
How should I construct the request, the headers and how should I specify the new name for the project?
I tried to write in the following in the Payload section of the request:
{"ProjectName"="New Name"}
It came back with a 403 (Forbidden) error.
Related
I've been developing a music Service for Sonos and have everything up and running. The problem I have is Sonos only requests 99 items through it's getMetadata call, some of my libraries have 300+ tracks in, so I'd ideally like to list them all out.
I can't find anything in the Sonos api documentation about how to list 100 or more items but I'm assuming it is possible because their reference page for getScrollIndices (http://musicpartners.sonos.com/node/103) alludes to a library much larger than 100 tracks.
You can set the default number of items requested in a getMetadata call by setting the BrowseOptions.PageSize value to something more appropriate for your service in a presentationmap.xml file.
E.g.:
<?xml version="1.0" encoding="utf-8" ?>
<Presentation>
<!-- I chose 400 based on your 300+ value in the question. -->
<BrowseOptions PageSize="400" />
</Presentation>
You can find documentation at the link below. Scroll down to 'Browse Options':
http://musicpartners.sonos.com/node/222
And you can find documentation on how to configure Sonos to read your Presentation Map during local testing here:
http://musicpartners.sonos.com/node/134
In essence, you need to host the XML file on a server (often the same server that hosts your Sonos API code), and configure the URL in the customSD form that points directly to the presentationmap.xml file.
Note: Sonos caches the XML file for performance. When you change the file, you must increment the version in the customSD form so Sonos controllers force a reload. This is explained in the 'Version' entry in the documentation here:
http://musicpartners.sonos.com/node/134
I am very new to MSCRM, so requesting for help. I am using Office365, i.e. MSCRM online organisation.
Here, I have written a plugin which should be fired when, in an Account entity, user uploads his image, the plugin stores the image as an attachment, in notes.
The plugin works fine, when I tested it by writing a console application.
I have registered the plugin and believe it will work fine here too. The only problem is I am unable to register the plugin new step.
The problem is in Filtering Attributes , I am unable to get entityimage attribute, even if i select/check All attributes.
Please suggest how should I proceed.
In this scenario you can write plugin on "Create" message of "Annotation" entity. And create message does not have any filtered attributes.
As you wrote and tested using Console Application, while converting it to plugin make sure that you are checking created note contains data into "FileName" and "DocumentBody" attribute. Along with you can also check whether this note is created against "Account" entity. This two conditions will narrow your scope, limited to notes created against account having some attachment. In plugin execution context you'll get above mentioned attributes.
I'm working on a REST API, and doing test and prototype work on Windows 10 with its native IIS install. The API is written in C#. I've created a class that derives from IHttpHandler, and derive from that to implement classes for my API's nouns. (This allows me to commonalize logging, config, auditing, etc, in my base noun class). To implement verbs, the derived classes override the base class' functions for GET, POST, etc.
Anyway, one of the nouns I have is for access to the application's log. The path for this is /log. In it I've implemented GET, to read the log, and DELETE, to clear the log. GET works fine, however, DELETE gives me a 401.3 from IIS. I also get the same 401.3 if I try PUT or PATCH. PUT and PATCH are not implemented in the Logging class, so they should return a not implemented message. I do get the not implemented message if I try POST (which is not implemented in exactly the same way that PUT and PATCH are not implemented).
As part of trying to narrow down this behavior, I checked whether there were specific verbs being blocked by request filtering (there weren't). I checked whether Process Monitor was catching file system access denials at the underlying path (it wasn't... things never got that far.) I then tried adding another handler mapping - exactly the same as the first, but with a different path name:
<handlers>
<add name="BLOBRepoLog" path="log" verb="*" type="BLOBRepoService.Log" resourceType="Unspecified" preCondition="integratedMode" >
<add name="BLOBRepoLogSanityCheck" path="foo" verb="*" type="BLOBRepoService.Log" resourceType="Unspecified" preCondition="integratedMode" >
</handlers>
Using Postman, if I call DELETE on /log, I get the 401.3. If I call DELETE on /foo, it works correctly. If I call PUT on /log I get the 401.3. If I call PUT on /foo, I get the correct not implemented message.
Anyone have an idea why IIS should be doing extra scrutiny on verbs called for the /log path?
Thanks,
Paul
I had a similar issue where Put and Delete weren't working, it turned out for me that Webdav was the issue. In my case I didn't really need it so I uninstalled it and everything worked.
I need help on how to successfully create a RepositoryMergeRequestCheck
As part of our merge workflow, we need to ensure some policies about some files. Policies includes among others:
File naming conventions of individual files
File naming conventions between multiple files (for example, correlative-named files)
Inspection of files to enforce or disallow usage of statements or functions
I want to be able to check for this policies on a repository merge request check so I’m building a plugin for Astlassian Stash
I have tried the following approaches:
Using the RepositoryMergeRequestCheckContext parameter of RepositoryMergeRequestCheck.check()
Since the method signature is:
#Override
public void check(RepositoryMergeRequestCheckContext context)
The first thing I tried using was the context parameter. I can say context.getMergeRequest().getPullRequest().getFromRef().getRepository()
Now I get a Repository instance and I’m not sure how to extract commit info from it.
Calling Git directly: Since this check was originally developed as a git hook script, calling git from the SDK made sense to me. It led me to this situation:
String result = gitScm.getCommandBuilderFactory().builder().lsTree().build(…).call();
Where gitScm gets dependency injected in the plugin’s constructor.
Notice the build parameter? It expects a CommandOutputHandler<T> in this case T is string, but that’s an interface, and I’m not sure how to get an instance that implements that interface or how to create one.
REST API
REST API looks the easiest of them but it still doesn’t help with the third requirement of inspecting file’s source code and also, spawning web requests from the merge request check that is itself a web request from stash doesn’t seem to be a good idea from the performance side.
What path should I follow or how can I do it?
I started writing you a response, and then realised that I'd already answered this on Answers (which was what I was going to suggest as well).
https://answers.atlassian.com/questions/182943/enforcing-policies-from-repository-merge-request-check-plugin
Cheers,
Charles
I like to creata package, POJO model asset with my java code ,using REST API.
Creating package with Apache HttpClient is fine, but I have problems creating a model asset, now I create "other assets, documentation" by putting the following
<entry xml:base="http://localhost:9080/repository/packages/package1/assets">
<title>testAsset1</title>
<summary>desc1</summary>
</entry>"
how do i make it a model asset? I tried to add a format tag but failed.
thanks
I think you can use the REST API to upload content. Send PUT request to URL something like
http://{server}/guvnor/rest/packages/{package name}/assets/{asset name}/source
Where asset name is the name of model assets. Not sure about what the mime type should be, a quick google search gave 'application/java-archive'
See the Guvnor REST API docs for more information.
You need to add below code to createAssetFromBinary method in PackageResource.java
ContentHandler handler = ContentManager.getHandler( ai.getFormat() );
if ( handler instanceof ICanHasAttachment ) {
((ICanHasAttachment) handler).onAttachmentAdded( ai );
}
You can also explore using standalone editor to create model & facts which will be stored directly in guvnor repository.