Previously, we are gettng all custom fields for specified issue from "RemoteIssue" object as RemoteIssue.customFieldValues. How to get same data using REST API for specific issue?
Thanks
Mohan
Wouldn't it be better to make custom fields a collection in the API like this:
{ "customfields": [ "customfield": { "required": false, "schema": { "type": "number", "custom": "com.atlassian.jira.plugin.system.customfieldtypes:float", "customId": 10112 }, "name": "count", "operations": [ "set" ] }, "customfield": { "required": false, "schema": { "type": "string", "custom": "com.atlassian.jira.plugin.system.customfieldtypes:float", "customId": 10100 }, "name": "count", "operations": [ "set" ] } ] }
That way there wouldn't be this giant hassle of finding "customfield_" in the text, trying to parse out the custom field, etc. It just comes back as a collection of custom field objects that can be readily converted using standard JSON. Since there are only a few "shapes" of custom fields on the client side I could make an aggregate object that could accept any of the types and the missing fields just get ignored.
Or am I completely missing something?
You're absolutely right. Don't know what ugly serializer Atlassian uses, but this mixture of named fields and custom fields makes it really bad to deserialize.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm having the same issue. It needs to be more dynamic for me. I need to be able to access a custom field by the user inputting the field name. This will only work in an array for me at the moment since I can store an array of objects, but I can't store an object linked to a field who's name is not yet known.
Does anyone know if there has been a fix to this problem or alternate solutions since 2015?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try using GET on
api/2/issue/{issueIdOrKey}/editmeta
Your output should be similar to this. It contains ALL fields.
{ "fields": { "customfield_10112": { "required": false, "schema": { "type": "number", "custom": "com.atlassian.jira.plugin.system.customfieldtypes:float", "customId": 10112 }, "name": "count", "operations": [ "set" ] }, "summary": { "required": true, "schema": { "type": "string", "system": "summary" }, "name": "sum", "operations": [ "set" ] } }
If you want to get the fileds values try Aleksander's code
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
https://docs.atlassian.com/jira/REST/latest/
Just use the /rest/api/2/issue/{issueIdOrKey} and there will be fields field inside response. All custom fields are there with customfield_{id} name.
For example try: GET https://jira.atlassian.com/rest/api/latest/issue/JRA-31629
If that's not what you need, then I need more info about what you need.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes Aleksander, i tried similar way. Here the problem is, all customfield_{id} are not coming in same structure. See the below data structure what i got,
"fields": { "customfield_10050": { "self": "link to field", "value": "Severe", "id": "10050" }, "customfield_10387": "7523", "customfield_10388": null }
So, not able to deserialize custom field JSON to .Net(C#) objects. Any idea how can i proceed?
One more problem here is, all customfield_{id} are not coming at one place(as collection).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You probably want to use expand=schema (and names if you also need the field name). When you run request with that option you'll get schema in reply, which says what is the type for field. So you will be able to parse field value according to its type.
For example, schema entry for customfield_10610:
"customfield_10610": { "type": "number", "custom": "com.atlassian.jira.plugin.system.customfieldtypes:float", "customId": 10610 },
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have check if not null and blank, but some fileds got object reference not set exception error if (!string.IsNullOrEmpty(issueResp.Issues[i].Fields.customfield_10709.value)) buildrequest.DbName = issueResp.Issues[i].Fields.customfield_10709.value;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Different projects in JIRA might have different customfields mapped to it. The get below should provide all customfields for project JRA.
https://jira.atlassian.com/rest/api/latest/issue/createmeta?projectKeys=JRA&issuetypeName=Bug&expand=projects.issuetypes.fields
I think the only way to get customfields and issuesTypes are based on query to specific projects.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this is the most accurate response actually. according to this example in the doc specs, you need to specify the "expand" parameter. interestingly enough, you can leave off the projectKeys and issuetypeName filters and just dump back the entire lot. rest/api/latest/issue/createmeta?expand=projects.issuetypes.fields https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-discovering-meta-data-for-creating-issues
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is it possible to further filter and get only certain custom fields based on If those fields are required or not. Or do I have to add that Logic from where I consume JIRA2 API?
The problem for me is when I use the above query I'll be getting 6000 lines of JSON response.. but If I can filter to get only customfield_{id}' s which are required there will be only ~100 lines of response. Please let me know If it's doable or not otherwise I'll filter in the consuming project after I got response back. TIA
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.