Project Server 2013 - Update Task using REST ODATA - rest

I wanted to update Project 'Task' metadata (for example the 'PercentComplete') from my own website. This update needs to be over HTTP as I am outside of hosted sharepoint server.
READ the property of Task using GET URL works:
https://myserver/_api/ProjectServer/Projects('proj_id')/Tasks('task_id')/PercentComplete
Response:
<?xml version="1.0" encoding="utf-8" ?>
<d:PercentComplete m:type="Edm.Int32">30</d:PercentComplete>
So I know authentication and validation works fine. But what call do I make to UPDATE this property of the Task.
I tried some of the posts like simple HTTP update with % in payload and creating a JSON with property name, but nothing works.
Could someone please share a code snippet that updates using javascript/jquery/ajax over HTTP to update the value from 30% to say 50%?

Related

Data Factory can't download CSV file from web API with Basic Auth

I'm trying to download a CSV file from a website in Data Factory using the HTTP connector as my source linked service in a copy activity. It's basically a web call to a url that looks like https://www.mywebsite.org/api/entityname.csv?fields=:all&paging=false.
The website uses basic authentication. I have manually tested by using the url in a browser and entering the credentials, and everything works fine. I have used the REST connector in a copy activity to download the data as a JSON file (same url, just without the ".csv" in there), and that works fine. But there is something about the authentication in the HTTP connector that is different and causing issues. When I try to execute my copy activity, it downloads a csv file that contains the HTML for the login page on the source website.
While searching, I did come across this Github issue on the docs that suggests that the basic auth header is not initially sent and that may be causing an issue.
As I have it now, the authentication is defined in the linked service. I'm hoping that maybe I can add something to the Additional Headers or Request Body properties of the source in my copy activity to make this work, but I haven't found the right thing yet.
Suggestions of things to try or code samples of a working copy activity using the HTTP connector and basic auth would be much appreciated.
The HTTP connector expects the API to return a 401 Unauthorized response after the initial request. It then responds with the basic auth credentials. If the API doesn't do this, it won't use the credentials provided in the HTTP linked service.
If that is the case, go to the copy activity source, and in the additional headers property add Authorization: Basic followed by the base64 encoded string of username:password. It should look something like this (where the string at the end is the encoded username:password):
Authorization: Basic ZxN0b2njFasdfkVEH1fU2GM=`
It's best if that isn't hard coded into the copy activity but is retrieved from Key Vault and passed as secure input to the copy activity.
I suggest you try to use the REST connector instead of the HTTP one. It supports Basic as authentication type and I have verified it using a test endpoint on HTTPbin.org
Above is the configuration for the REST linked service. Once you have created a dataset connected to this linked service you can include it in you copy activity.
Once the pipeline executes the content of the REST response will be saved in the specified file.

Using Insomnia To Make Soap Calls

I am trying to use Insomnia to make soap calls - specifically trying to get post to succeed. I defined the URL as the end point and put the body type as XML with the SOAP contents (envelope, header, body). I defined the user id and password in the header. When I run I get 415 Unsupported Media Type. I can't really paste the soap contents because of all of the URL addressing in the envelope. I am using Insomnia to succeed in doing the REST call to get my information (for some crazy reason the gets are REST but the posts are SOAP) but can't get the insert to work. Is there something special I need, or does Insomnia not support SOAP post transactions? I googled and it appears in 2018 this was added. I don't have the WSDL available.
I appreciate this is not giving lots of information so guidance on what more I may provide to get assistance will also be helpful. Has anyone succeeded in using Insomnia to make SOAP calls?
All that was needed for me to make it work was:
Request method: POST.
Setting the Content-Type header to text/xml; charset=utf-8 (application/xml gave me the 415 response).
Wrapping request body in proper SOAP envelope.
You should be able to call GET on YourHandler.asmx to look up envelopes for requests you want to use. Envelope should look somewhat like this:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<HelloWorld xmlns="http://tempuri.org/">
<foo>
<Id>1</Id>
<Name>Bar</Name>
</foo>
</HelloWorld>
</soap:Body>
</soap:Envelope>
Credits for the guidance and envelope sample goes to this answer.
You can import the WSDL file, so that all methods, headers etc. will be created automatically. Click on:
Go to dashboard
Click Create
Choose URL (under import from)
Paste the WSDL URL and click Fetch and Import
As an example you can use the following URL: http://www.dneonline.com/calculator.asmx?wsdl
You will get this:
The problem as of writing this answer is, that there are two bugs:
Not all WSDL URLs are getting imported correctly (e.g. this one works in SOAP UI, but not in Insomnia http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL)
The methods are getting imported, but they don't work
You can submit and issue on Github, so that this is getting fixed: https://github.com/Kong/insomnia

How to convert soap message in Oracle OSB

I'm just starting with Oracle Service Bus 12C.
I created a proxy service that takes in a couple of parameters. A pipeline that moves those parameters to the request-headers. A business service that calls my PHP. So far, the PHP receives the parameters correctly.
Next, I am returning a response from PHP. As a first step, I did a simple echo "Hello, World";
Two things are happening at this point.
Firstly, when debugging the app, JDeveloper shows that $body in Response Action is blank. However, in a log action, I added $body. That shows:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">Hello, World</soapenv:Body>
No idea why JDeveloper doesn't want to show this.
So, how do I get the string part from this so I can use a Insert Action to build the XML response that the proxy service would understand?
I tried these in the log action, but all of them give blank outputs:
$body/*
$body/soap-env:body
$body/soap-env:Body
$body/soap-env:Body/#value
$body/soap-env:body/#value
Edit: According to https://docs.oracle.com/cd/E13171_01/alsb/docs25/consolehelp/context.html $body/* should extract the payload without the soap-env:Body wrapper.
Got it:
$body/text()
I noticed that the tag is soap-env in the request and soapenv in the response. The $body/* works for the request to remove the wrapper in the request only.

Cannot retrieve results from Bamboo using REST API

I am trying to build result information from an Atlassian hosted instance of Bamboo using the REST API, but have hit a roadblock almost immediately.
Trying to get the result information for a specific plan I would expect the following URL to return a result set:
https://mydomain.atlassian.net/rest/api/latest/result/PROJECT-PLAN
Where PROJECT-PLAN has been copied from the UI URL for the given plan:
https://mydomain.atlassian.net/builds/browse/PROJECT-PLAN
This is based on the documentation here:
https://developer.atlassian.com/display/BAMBOODEV/Bamboo+REST+Resources#BambooRESTResources-BuildService—SpecificPlan
However, when I try to retrieve this through my browser (authenticated, with access to the UI URL), I get the following response:
<status>
<status-code>404</status-code>
<message>
null for uri: https://mydomain.atlassian.net/rest/api/latest/result/SFDC-AQB
</message>
</status>
I fear I must be missing something obvious.
Turns out that my base URL was directing me to the JIRA REST API, rather than Bamboo:
Adding "builds" into the URL solves the problem.
https://mydomain.atlassian.net/builds/rest/api/latest/...

Unable to create(POST) objects (Account, customer...) on QB Windows using IDS and Sync Manager

Here I am provideing you the complete scenario where I am getting the error while posting request for creating a new account.
I am using Intuit OAuth Access and OAuth API console for testing (Using all security tokens).(https://appcenter.intuit.com/Playground/OAuth)
And the URL and request:
URL: https://services.intuit.com/sb/account/v2/570357960
Method : Post
Format: XML/JSON
Request:
<?xml version="1.0" encoding="UTF-16"?><Add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" RequestId="4df87bw2-916a-
4r95-h5d6-06dce3667562"
xmlns="http://www.intuit.com/sb/cdm/v2"><ExternalRealmId>570357960</ExternalRealmId><Objectxsi:type="Account"><Name>CurrentAccount</Name><Active>true</Active><Type>Expense<
/Type><Subtype>Expense</Subtype><AcctNum>1111</AcctNum></Object></Add>
And getting the response (error in html):
<div class="content-container"><fieldset>
<h2>500 - Internal server error.</h2>
<h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3>
and I have also checked with RESTClient utility, but getting the same above error.
Please note that the same url
(https://services.intuit.com/sb/account/v2/570357960) with same
security tokens is working fine for GET data , I am getting data from
QB desktop into my online Application.
As Keith said, check the Content-Type. You will also need to use a RestClient for testing. The playground will not work for testing API calls. It only works for platform calls.
If I had to guess... I'd guess you're sending the wrong Content-Type header... but it's impossible to tell for sure until you post more code/the rest of your HTTP request.
A few things to try. Be sure the XML is in the same order as this sample and try it.
the other is a common mistake when you use Oauth in a GET you are including just the url in the signature, but in a POST you need to include the Body in the signature too or it will not pass Oauth validation.
Lastly, as Keith mentioned to check the content type. Although you would generally get a content type error.
156234822
CurrentAccount
true
Expense
Expense
1111