Consuming TFS Web Hooks (Post via HTTP) - wcf

Is there a specific request format that the webhooks have? I am using the Pull Request Updated event, and I am trying to deserialize into a class, but I do not know what fields I will need. Is there a class or example of the request content details for the different events?

As far as I know, there isn't a generic template for the HTTP post request/response from TFS.
The TFS HTTP post JSON request/response format is based on the specific action.
For example, for the web hooks whenever a work item is updated.If I update a description field, I am getting one format and if I add a child work item, I am getting another format.
However for the specific event, you can check the response format, then get the useful information which you needed.
Please refer to Send JSON representation to a service for more information.
And at the end of the Q&A part there is a sample JSON.

Related

Data storage after API call form Postman/SoapUI

I need to create an automated test-setup for some webservies, and plan to use SoapUI or Postman for that. My question is pretty basic. What happnds to the data after a request is made?
E.g. if the response contains data from a system, and display it in the Postman UI, will Postman store the response? Or what will happnd to it after the request?
I'm asking for security purpose and I was not able to find a concrete answer myself. Thank you in advance.
Postman provides us the explicit ways to store data or not. When you try to run a collection then in the settings we can specify if we want to store responses, cookies, etc or not. Configure it as per your need.
As per the official site
"Postman does not track any content of your requests/responses."
Under File--> settings
You can even avoid using the cloud version if you don't want to sync up things
Re SoapUI...
If you call a service once, then the data remains in the UI. If you run a second or third time, then only the last response is shown in he UI.
Once you close SoapUI, the request and response data is gone.
However, you can save the data from every request and response by using a datasink step, should that be what you want.

Fetch data that is not a registered react-admin resource

Using react-admin, I have build an ExpressJS API including a GraphQL endpoint. All my resources in react-admin are using the graphql data provider. For a specific resource, I'm looking to fetch some configuration from my API endpoint to generate the form based on the context. I will try to create a mock example as I can't use the actual application's lingo.
For example, if I edit resource Post, and I assign a specific type "Photo", then I want some specific metadata to be saved in the form. My issue is the specific metadata object is coming from the API configuration for type "Photo". So if I select type "Photo", I want to save "Capture Date", "Camera Make", "Camera Model", etc.
The backend configuration would probably be in the form of a JSON schema describing the fields, the label, the key and the type of input (text or password).
TLDR: I want to fetch a configuration in the API and use it in the app to generate a list of form inputs. How can I do this without registering the call as a resource, since I don't feel like it is?
Edit
I haven't tried anything yet as I was asking a theoretical question to see if anybody had a "proper way" to suggest. My two options were the following:
Create a Resource for the PostType and it would simply return the list of fields as a JSONschema when called with GET_ONE. This would make use of the dataProvider to do the fetching.
Simply use fetch in my form and call my API endpoint directly.

Zapier Webhooks add data to default payload

I am setting up a Zap on Zapier and i have been trying to send a payload from Shopify(create order) to a Webhook which is sending data to an API. The problem i am having is adding data to the default payload(all data). I want to send all the data from the payload plus some additional attributes which i am configuring on the Data section, but this replaces the default-all data.
Is there a way to add a value to all the payload? I know i have the option to add the value by header or query string but i would like to add to the body instead. I am currently viewing the custom request but it seems complicated to configure the whole request to just add one value.
Thanks in advance.
David here, from the Zapier Platform team. This is a great question!
The short answer is that it's not possible to do quite what you want. You'll need to map each property into that data box like you're doing and add the custom properties you want.
That said, we track all feature requests that come in through tickets, so if you'd like to voice your support and get notified if/when this does get implemented, I'd suggest emailing in to contact#zapier.com.

Restful api custom types

So I am building a restful api allowing users to send events.
There are "standard" events like birthday, wedding, etc that each have their separate properties. So if someone sends data for type = birthday they can also specify the parameters date_of_birthday, new_age, etc. If they send type = wedding, for example, they have to specify different properties.
So basically when they make /event/create api call, they specify a type and a list of properties based on that type. If they want to specify a "custom" type they can. In that case the properties they specify are up to them.
How best to build this api so that it is true to rest?
To create an event, clients should make a POST request like
HTTP POST: /event
The post parameters should contain the event details and can be of any structure that the application understands.
Create events using POST, this request it self stands for "Create new" event. I would also suggest following structure of your API URIs:
POST /event/birthday //Create new birthday event
POST /event/wedding //Create new wedding event
...
generally:
POST /event/{event_name}
this will help you provide clear structure of the RESTful API. E.g. getting all event types can be retrieved with GET /event, getting all birthdays with GET /event/birthday, getting weddings on 1.1.2014 GET /event/wedding/1-1-2014 etc
Think of your resource URI structure in the same way, you will define a folders and files structure.

POSTing to web service API in Objective C?

I'm writing one of my first apps for consuming a web service in Objective C, it's a Lighthouse API client. I'm able to execute all the GETs and XML parsing correctly and quickly, but I'm having extreme trouble trying to create a new ticket via POST (http://lighthouseapp.com/api).
I'm using ASIHTTPRequest.
I tried including the parameters on the URL (i.e. POST /projects/#{project_id}/tickets.xml?title=boo).
I've tried putting the ticket XML in the request body.
<ticket><title>boo</title></ticket>
Nothing is working. (server always sends a response back saying it needs a title) I'm very new to web services - am I missing something obvious?
I had a quick look at the Lighthouse API and here's how you go about creating a new ticket.
Request URL is http://{yourCustomURL}.lighthouseapp.com/projects/{ProjectID}/tickets.xml where {ProjectID} is a 5 digit number - in my case 72945.
Method is POST
Content type should be set to application/xml
Body should be in the format below. All fields are optional so I only included the title
<ticket> <assigned-user-id type="integer"></assigned-user-id> <body></body> <milestone-id type="integer"></milestone-id> <state></state> <title>Testing new ticket creation</title></ticket>
(sorry about the formatting of the code above, SO doesn't seem to like XML formatted code somehow?
This worked for me with a new ticket created under projectID 72945 - response received was 201 Created
If you want to make sure your POST request is working before diving into ASIHTTPRequest, download a Firefox add-on called POSTER from here. This will allow you to send an authenticated post request with all the fields above. Once you get that working, it should be a piece of cake to get ASIHTTPRequest to do the same.