I can't make post request to dealFields endpoint, though i can make a get requests. I'm using sandbox account, i'm the only one administrator, the access to deals is allowed. I'm using access_token and integration app

@Get(‘new-field’)
async addDealField() {
try {
const { data } = await this.axiosService.$api().post(https://gosha-sandbox.pipedrive.com/api/v1/dealFields, {
name: ‘Job Type’,
field_TYPE: ‘TEXT’
})
return data
} catch (e) {
return e
}
}

Hi :wave: @djorji5803, welcome to the community.

I think the issue is that we do not support capital letters in the properties.

Can you try to change field_TYPE: ‘TEXT’ to field_type: ‘text’ to see if it helps?

Alternatively, you can share the error message that is returned from the request.

Jakub

Hi, i’ve already fixed this one, but now, cant figure out how should look my PUT request, when i want to set value of dealField.
I mean where should i pass the value which i want to set, and how should i specify exact field, which value i want to set

Hey,
the PUT method is a regular REST call. I think the best option to understand how this works is to check our Postman collection. It is pretty neat. There are all available calls possible, already prefilled with some dummy data.

An example curl PUT request for dealFields might look like this:

curl --location --request PUT 'https://gosha-sandbox.pipedrive.com/api/v1/dealFields/92875845?api_token=<API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
    "name": "Job Type",
     "options": "{value}", // Format of the value depends on the type of the field.
    "add_visible_flag": true
}'

However, the specific usage depends on the chosen library.

It seems like in your Postman collections you are using API_TOKEN in requests, but i’m not using any libraries, and i’m making requests with Authorization Bearer Token
In POstman Collections, it;s just shown that options must be array of objects, but not how can i specify a value of a field.

There are two ways to authorize against Pipedrive. OAuth or api_token. You can read the OAuth setup on a related page or way easier for you is to use the api_token for now.
As you can see in the example above I provided, the token is passed directly as a query parameter in the path.

https://gosha-sandbox.pipedrive.com/api/v1/dealFields/92875845?api_token=<API_KEY> <— your api_token

The updated value for the field should be passed into the options parameter. How the value should look depends on the type of the field. Usually it is going to be some stringified JSON. An example you can find in the public documentation:

When field_type is either set or enum, possible options must be supplied as a JSON-encoded sequential array of objects. All active items must be supplied and already existing items must have their ID supplied. New items only require a label. Example: [{“id”:123,“label”:“Existing Item”},{“label”:“New Item”}]

Is it also easier to use API_TOKEN when i’m makin the integration app in your crm?\

The recommended authorization protocol for all public apps available in the Pipedrive Marketplace is the industry-standard OAuth 2.0 protocol.

In case you are building your private app the api_token is a sufficient way to proceed.

I just wanted to use recommended method instead of a sufficient
Can you, please, tell me for which key i shoul specify the value in body of request to send it to the value of a dealField.
does “label” key expects the value that will be assigned as a custom field value?

I just wanted to use recommended method instead of a sufficient

To use the api_key for your app is both sufficient and recommended.

Can you, please, tell me for which key i shoul specify the value in body of request to send it to the value of a dealField.

As I wrote earlier:
The updated value for the field should be passed into the options parameter. How the value should look depends on the type of the field. Usually it is going to be some stringified JSON. An example you can find in the public documentation

does “label” key expects the value that will be assigned as a custom field value?

No. “label” in the documentation is key in an example. It is supposed to be used field_type set or enum as follows.

{
   options: [{"label":"New Item"}]
}

in docs there’s only examples with label field

Yes, it is. The documentation does not include exhaustive examples of how to update the field.
But talking about the field, it means the definition of the field.

If you’d have for example your custom field that displays as a field with each deal and want to change its value, you have to do it via PUT v1/deals/{id} endpoint.