According to eirikb's answer, I tried to implement it and I've really faced a lot of issues.
So, I'll try to be clearer and to help futur developers to handle it correctly.
Here is what worked for me:
How can I retrieve all taxonomy fields via REST API?
It exists a hidden list which will give you all the taxonomy fields:
EDIT: Sharepoint indexes this list, it means that if you add some new taxonomy fields, this list will not be up to date. In order to force the update of this list, you will have to set all your new taxonomy fields at least once on a document set metadata of taxonomy type. After that, you will be able to see them into that list. Also, it is paged after 100 items, you will have to use the call inside "__next" property of the body response in order to get the next 100 (& x) taxonomy fields.
"Term": "My test tag"
"Term": "Another tag for test"
Retrieve the hidden InternalName
Alright, but imagine you want to set one of those taxonomy fields to a
metadata of a document set or a list item or whatever. How can you
handle it ?
As simple as below, for our example, we will say that our metadata is named MyTaxonomySharepointField.
I actually don't know why but you will not be able to set taxonomy values by directly using the original name of your metadata (which is MyTaxonomySharepointField). For that purpose, you will have to retrieve the real InternalName which is hidden behind the metadata by suffixing it with "_0", thank you to eirikb.
Retrieve the hidden InternalName like that:
Giving you a result like:
Once you'll retrieve the hidden InternalName, you will have enough infos to be able to set some taxonomy values on a metadata of TaxonomyField type.
A taxonomy value has to be formatted like this (according to the received properties from the TaxonomyHiddenList call):
Where if you use the first field from the TaxonomyHiddenList call, it should be rendered like:
'-1;#My test tag|19f40567-ef4c-41b0-a023-039275d66efd;'
For developers who want to set multiple values, you should use the '#' separator by concatenating your formatted values (still using my first call for the example below):
'-1;#My test tag|19f40567-ef4c-41b0-a023-039275d66efd;#-1;#Another tag for test|f2413c10-301d-4fe6-a171-ff4ad73bbafa;'
Now, here is the final datas to post for updating the metadatas of your document set (for example):
"Title": "My new document title",
"Description": "Here is an updated document set via REST API",
"p45b125f993940dca2b573bf64a02cff": "-1;#My test tag|19f40567-ef4c-41b0-a023-039275d66efd;#-1;#Another tag for test|f2413c10-301d-4fe6-a171-ff4ad73bbafa;"
NB: p45b125f993940dca2b573bf64a02cff is the hidden field of your metadata MyTaxonomySharepointField