How to get json data using REST API for on-premise TFS - json

We have on-premise TFS Version 15.105.25910.0 i.e TFS 2017 and I am trying to get JSON data (let's say for a given Work Item id). I am using Postman to send/receive request. I was having an issue with permission denied then figured out a way to pass Personal access tokens in the request.
Our basic TFS Url looks like this:
http://tfs.blahblah.org:8080/TFS/MyOrgName/Software%20Group
How to correctly get JSON data?
Reference material used:
Reference 1
Reference 2
Currently I am getting 200 OK status but the content type is HTML which says Javascript is Disabled. Not sure where the problem is occuring?
Feel free to ask more info if needed.

First, you are using TFS 2017 RTM version, it's suggested to upgrade to the latest Update 3.1 edition.
Then, please check your Postman's version, make sure you are using the latest version v6.1.4. You could download the latest version from website below: https://www.getpostman.com/
Last, check whether you have correct api. The REST API to get a single work item is as below:
Get http://TFS2017:8080/tfs/DefaultCollection/_apis/wit/workitems/{id}?api-version=3.2
Attach a screenshot of the result in Postman:

Related

TFS API Json Documentation

I use the the TFS Builds in my application and was wondering if there is a documentary for the json response which i get from the TFS API. Especially for the field "AuthoredBy".
Here an example of the response json.
Yes there is documentation (https://www.visualstudio.com/en-us/docs/integrate/extensions/reference/client/api/tfs/build/contracts/builddefinitionreference) but it is not kept up to date, is incomplete and wrong on many instances unfortunately :(
Edit: i noticed the link i posted at that time now forwards to a different api... here is the updated link -> https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds?view=azure-devops-rest-5.0

How does restangular talk to MySQL database

I am total JS newbie working on a project build in Grail 2.4.4, a web-app. It's a working app, build by a developer whom is not available anymore.
To get it to work locally I had to upgrade it to Grails 3.2.0. I got it almost working in Netbeans. But I got stuck at getting the data from the MySQL database.
The Chrome inspector says:
angular.min.js GET http://localhost:8080/<app>/currency/allCurrencies 404 ()
The controllers are written in Restangular which call the above URL.
What am I missing?
Firstly, Restangular is an Angular library which simplifies and standardizes making calls to a REST backend (which in your case is a Grails app). So, Restangular does not directly retrieve data from your a database, it invokes a web service which (in some cases) may retrieve data from a database.
In your case, Restangular is attempting to retrieve data from the endpoint http://localhost:8080/<app>/currency/allCurrencies but you are getting a 404 response, indicating that there is no endpoint mapped to this URL.
HTTP REST helps you connect to the API easily. Restangular can handle that by sending standard methods [Get, Post, Delete, Put] to the api like what you see.
This mean StudentController > Get()
localhost:2045/api/student
This mean StudentController > Get(Guid id)
localhost:2045/api/student/8ae37cfa-905b-4c71-ad03-bf416d93bdf8
This mean StudentController > POST(Guid id) ... if you send Post method to the API, it will detect it, this work also on put method
localhost:2045/api/student
use this module to get easily rest api.
Http-Rest-Service

implementing REST sdk for custom platform

I am implementing paypal REST integration for a new platform
I got stuck and would apprecıate any help
The interesting problem I get is the REST request I copied from the documentation page gives error. https://developer.paypal.com/docs/rest/api/payments/
I am not using command line but a little windows app to send web requests.
I just used exact same payload and got this error
The remote server returned an error: (503) Server Unavailable.
{"name":"INTERNAL_SERVICE_ERROR","information_link":"https://api.sandbox.paypal.com/docs/api/#INTERNAL_SERVICE_ERROR","debug_id":"c4a8716d8a791"}
The C# sample from the github works and when I use th json it generated everything works ok.
I found out that if I change the cardnumber the sample works. Will let paypal team now.

Comprehensive CEP (Proton) REST API documentation

I've searched the repo + FiWare Wikis and was unable to find any detailed API documentation.
I saw this: http://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Complex_Event_Processing_Open_RESTful_API_Specification
I'm running a CEP instance on Fiware Cloud, and keep getting 500's and 405's for the calls I'm trying.
Yet it often references the user guide for more details on each endpoint parameter. Is there a more recent version?
Last release was more than a year ago, according to that spec. Are the docs up to date with the latest API version?
Else I'll have to reverse-engineer the API...
PS: CEP instance is running # http://130.206.117.120:8080/
Let me know if there are some sanity checks I can make ;)
I'm also using CEP and for REST API I haven't found newer specs (from the doc you linked). However, I didn't have any problems getting the resources.
You can try
GET: http://130.206.117.120:8080/ProtonOnWebServerAdmin/resources/instances/ProtonOnWebServer
It shows state and definitions-url of the engine.
I found it helpful to browse through examples from engine also, or from tuts.
I saw that your instance uses DoSAttack definition and I have tried POSTing to engine: POST: http://130.206.117.120:8080/ProtonOnWebServer/rest/events, header: Content-Type: application/json, payload: {"Name":"TrafficReport","volume":"22"} and got 200 OK.
For more complex tasks (apart from REST API) this PAGE lists latest specs.
Hope it helps!

How to set ServerCredential in Backgrounduploader in WinJS app

I called attached code below in WinJS app and keep getting this error 405 Method Not Allowed. I have changed the method property to "POST" , still the same thing. Some of the guys saying it is to do with the permission so I am trying to set the credential in the uploader. This is an internal app so we assume this should carry the Windows Authentication. But at the moment, I could not find how. Can anybody help?
uploader.createUpload(endpoint, file)
.startAsync()
You haven't narrowed down the problem to the point where you should be worrying about how to express what you need with BackgroundTransfer APIs yet - you need to figure out what you need to express, first.
If you have access to good documentation or a knowledgeable owner of this internal service you're connecting to, your first step should be consulting that to figure out what exactly the HTTP request (and the associated credential headers) should look like.
If you don't have access to that, the second best starting point is to take an existing, working client of this service you're uploading to and use a networking capture software (Fiddler, for example) to take a look at what the request it's sending looks like.
Once you've figured out the specific HTTP method and server credentials you need to use, you can tell BackgroundTransfer to use them by setting the method and serverCredential properties of your uploader object before creating your uploads.