We are using the _apis/wit/workitemtypes/{workitemtype}/fields?$expand=all&api-version=5.1 API to fetch all fields for a particular workitem type and then use the _apis/wit/fields/{fieldreferencename}?api-version=5.1 API to fetch extra details about each field.
With the output we receive we're able to distinguish number, text, single-select fields.
However multi-select fields have no attribute that helps us identify them as multi-select fields. Is there any other API for that? Another problem we have is that we're not able to distinguish custom fields from fields fields.
However multi-select fields have no attribute that helps us identify
them as multi-select fields.
I'm afraid this is not supported in current Rest-API here. For now Rest-API doesn't support to check whether a field is multi-select.
Is there any other API for that? Another problem we have is that we're
not able to distinguish custom fields from fields fields.
I think the api(_apis/wit/fields/{fieldreferencename}?api-version=5.1) in your question can handle this. For those custom fields, their referenceName is always in format: Custom.FieldName. See:
So to determine if one field is custom one, we just need to check its referenceName's format. Hope it helps and if I misunderstand anything, feel free to correct me.
Related
Can I add an unique custom field inside a work item.
So when a new work item is added, a validation error occurs if a previously added work item already contain a that value.
I've tried inside the "Rule" section of work item customization, but without success
There is no built-in rule to enforce uniqueness. The only field that is guaranteed to be unique is the work item ID.
It is possible to create a custom control that uses the REST API to query whether the contents of a field are unique and have it enforce that uniqueness. But that has a few caveats. The rule will only be enforced in the UI, other experiences (like bulk changes, excel etc) won't triggr this validation. Direct manipulation through he REST API won't either. And I would expect concurrency problems when you venture in this direction.
Documentation and Code Sample
In the documentation above there are only two parameters.
However, in the code example they are using fields as parameters.
I tried searching the docs but I'm still unclear on how fields and params are different.
Are they completely interchangeable or are there specific times to use each?
I tried searching the docs but I'm still unclear on how fields and params are different. Are they completely interchangeable or are there specific times to use each?
Fields are the specific data elements you can request about an object.
A user’s e-mail address, a post’s message, a page’s cover photo – those are fields.
Parameters allow you to limit the selection of data, based on specific criteria.
You request a page’s feed, but you only want posts from a specific time frame - then you use parameters like since and until, for example.
If you are familiar with basic SQL, you could use this as an analogy: Fields would be the column names you specify after SELECT; Parameters would be the WHERE clause.
I reached out to Facebook Support and this was their answer:
Parameters are inputs to an API that specify constraints on the range
of data that will be returned (time ranges, specific ids etc.). Fields
are what are returned by the API, if you want specific fields to be
returned, these can be specified by adding something like
"fields=id,name..." to an API.
Parameters and fields are not interchangeable.
My questions concern the Transaction data object in Intuit's Customer Account Data API.
I am not sure how to use the following fields (or even really what they mean):
correctAction: The documentation does mention that "replace" and "delete" are possible values, which leads me to think that the word "correct" is being used to mean "fix", not as in the opposite of "incorrect".
correctInstitutionTransactionId: The documentation does not provide any details on this field. My best guess is that this id is used in conjunction with the "correctAction" field. I do not know how.
How do I use these fields?
I'm designing a RESTful API and I'm asking myself question about the filter field.
On my gets queries I want the user to be able to select the fields he want to get in the response. I was pretty sure that it would be the field filter jobs to give me the requested field but, after some reshearch, I found that most of the time it's used to add criteria on the fields, as a IF. Is it the user that needs to make show or hide the fields ans the Api return the full ressource everytime ?
I got an other question which is about the URI representation of such filter. Should it be something like /foo?fields=[bar1,bar2] ?
Thanks
It's not common to have a resource where you can specify what fields you want returned, by default all fields will get returned. If your resource has a lot of fields or some fields have really big values, it can be a good idea to have a way to specify which fields you want returned.
In REST there are no strict rules about how you should design your URLs for filters. It is indeed common to use GET parameters because they can be optional and don't have to be in any specific order. Your proposal of /foo?fields=[bar1,bar2] seems fine, however i would personally leave off the brackets.
Google Compute Engine API uses the 'fields' request parameter (see the documentation). The syntax is flexible enough to let user select/restrict even the nested elements. You may find it useful.
Yoga is a framework that allows you to deploy your own REST API's with selectable fields. This can reduce roundtrips to the server, and improve performance.
I allow Users that have nothing more than username/email/password.
But if they want to access certain areas, i need more information and present a form to them.
Now i want to validate this form, but whatever data is sent, it is valid since the entity is allowed to only have three basic attributes.
Simply checking for the desired fields needed to access a certain area is fairly easy, but communicating missing fields to the form is more complicated.
I'd have to match the fields to the form elements, add custom error messages and so forth.
Is there a best practive for my Problem?
Read up on Validation Groups — that's what you need.