Gemini Community Support Site

This Gemini community support site can be used to find solutions to product issues. You can log in using Open Id, Google Profile and even Facebook. Feel free to ask a question or browse FAQs and documentation. Product tour videos are also available along with how-to videos demonstrating key Gemini capabilities.




Issue with creating issue

api

I'm trying to create issues with the REST API. And I can do so, but I can't figure out how to set the new issue's assignee. Looking at the XML of GetIssue(), I see an IssueResourcesID element that looks promising, but when I pass a user ID in through it, I get no errors but also no assignee. There's also an IssueResources element that looks a lot like the Components element; in the case of the latter, I was able to do this:

[Components][IssueComponentEN][ComponentID]12[/ComponentID][/IssueComponentEN][/Components]

and it worked great. So I tried this for the assignee:

[IssueResources][IssueResourceEN][IssueResourceID]43[/IssueResourceID][/IssueResourceEN][/IssueResources]

but it produces this error:

object(SimpleXMLElement)#5 (3) {
  ["Exception"]=>
  object(SimpleXMLElement)#4 (8) {
    ["InnerMessage"]=>
    string(53) "Object reference not set to an instance of an object."
    ["InnerSource"]=>
    string(28) "CounterSoft.Gemini.Presenter"
    ["InnerStack"]=>
    string(172) "   at CounterSoft.Gemini.Presenter.IssuePresenter.CreatePartialIssue(IssueEN issue)
   at CounterSoft.Gemini.Web.Api.IssuesRestHandler.PartialIssueCreate(RequestDetails rd)"
    ["InnerType"]=>
    string(29) "System.NullReferenceException"
    ["Message"]=>
    string(57) "Exception has been thrown by the target of an invocation."
    ["Source"]=>
    string(8) "mscorlib"
    ["Stack"]=>
    string(784) "   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at CounterSoft.Gemini.Web.Api.x984df3e201a5cc4a.xd8c6760a50aeba18(RequestDetails x4f7dd955f6bfaf92, MethodInfo x2a154456227d18a2)"
    ["Type"]=>
    string(43) "System.Reflection.TargetInvocationException"
  }
  ["Message"]=>
  string(57) "Exception has been thrown by the target of an invocation."
  ["Type"]=>
  string(19) "InternalServerError"
}

Since it's an internal error and not an error message intended for client consumption, I'm inclined to think that I've hit on both the correct method of setting an assignee and on a bug in the service. Am I right in thinking this? Or am I just doing going about this completely wrong? In the latter case, what's the correct way?

Thanks!

bobw
· 1
bobw
Replies (8)
helpful
0
not helpful

You are using the wrong REST method. Create the issue and add to the returned entity the issue resource(s) (you can use get issue that has resources to see the XML).

Send it to the update issue full REST method: /api/issues.ashx/issuesfull/ISSUE ID/force/0 or 1

Make sure you set the state of the issue to Updated and the state of the resource(s) to New.

See our API site: http://api.countersoft.com

 


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

OK, so in other words, you can't specify the assignee (resource) when you create the issue; you have to create the issue without the assignee and then update it to add the assignee. Is that correct? If so, a quick note to that effect in the docs would be helpful.

Once I get the issue back to update it, what XML do I need to add? Right now, I'm adding this to the IssueEN > IssueResources element:

[IssueResourceEN][IssueResourceID]12[/IssueResourceID][/IssueResourceEN]

so that the overall result looks like this:

[IssueEN]...[IssueResources][IssueResourceEN][IssueResourceID]12[/IssueResourceID][/IssueResourceEN][/IssueResources]...[/IssueEN]

Should that be good enough, or do I need to specify other information, as well? What I'm getting back is this:

object(SimpleXMLElement)#5 (2) { ["Message"]=> string(57) "Invalid URI - Cannot update Resource as it does not exist" ["Type"]=> string(16) "MethodNotAllowed" }

BTW, I'm making a PUT request to a URL like this:

http://example.com/api/issues.ashx/issues/issuesfull/3104/force/1?format=xml&gemini-username-token=XXXX==&gemini-api-token=XXXX==


bobw
· 1
bobw
helpful
0
not helpful

You can create issue with resources. Simply add the resources to the XML when creating the issue the same way you did for the update and that should do the trick.

Otherwise, you need to set the state of the issue resource to New for th update to work.

What programming language are you using to do this? I am asking because we are due to release a working Java sample very soon, which might help.


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

[quote user="SaarCohen"]

You can create issue with resources. Simply add the resources to the XML when creating the issue the same way you did for the update and that should do the trick.

[/quote]

That's what I was originally trying to do. I'm creating the issue using CreateIssue with the issuespartial option (which I understand works just like the full version but auto-fills in any missing fields), but I can't get it to assign the resource. This is the XML I was adding to the IssueEN block:

[IssueResources][IssueResourceEN][IssueResourceID]43[/IssueResourceID][/IssueResourceEN][/IssueResources]

but I get the error I included in my original post, which is a Gemini-internal exception.

[quote]

What programming language are you using to do this? I am asking because we are due to release a working Java sample very soon, which might help.

[/quote]

I'm working in PHP. If, however, the Java sample has clear snippets of XML that I can see without digging around too much, it may still help, as it's the XML that I'm having trouble with. Basically, the docs just don't cover what is or isn't required. (On that note, I noticed, too, that the XML schema is coming to the docs at some point, and I'd guess that a listing on the methods of what's required and in what format will come with it - that'll most definitely be helpful.)


bobw
· 1
bobw
helpful
0
not helpful

Here is a sample issue XML with resources, component and affected version:

<IssueEN>

<AffectedVersion>

<AffectedVersionEN>

<IssueID>16</IssueID>

<AffectedVersionID>312</AffectedVersionID>

<VersionID>3</VersionID>

<DateCreated>2009-07-01T10:46:31</DateCreated>

<TimeStamp>AAAAAAAAC7o=</TimeStamp>

</AffectedVersionEN>

<AffectedVersionEN>

<IssueID>16</IssueID>

<AffectedVersionID>313</AffectedVersionID>

<VersionID>2</VersionID>

<DateCreated>2009-07-01T10:46:31</DateCreated>

<TimeStamp>AAAAAAAAC7s=</TimeStamp>

</AffectedVersionEN>

</AffectedVersion>

<IssueResources>

<IssueResourceEN>

<IssueID>16</IssueID>

<IssueResourceID>234</IssueResourceID>

<UserID>2</UserID>

<DateCreated>2009-07-01T10:46:31</DateCreated>

<TimeStamp>AAAAAAAAC70=</TimeStamp>

</IssueResourceEN>

</IssueResources>

<ProjectID>2</ProjectID>

<IssueType>2</IssueType>

<IssuePriority>1</IssuePriority>

<IssueSeverity>1</IssueSeverity>

<IssueStatus>2</IssueStatus>

<IssueResolution>3</IssueResolution>

<ReportedBy>1</ReportedBy>

<FixedInVersion>4</FixedInVersion>

<IssueSummary>Sample REST Issue</IssueSummary>

<IssueLongDesc>REST ISSUE CREATION</IssueLongDesc>

<StartDate>2008-11-24T12:00:00</StartDate>

<DueDate>2008-11-25T12:00:00</DueDate>

<RiskLevel>1</RiskLevel>

<EstimateHours>24</EstimateHours>

<EstimateMinutes>0</EstimateMinutes>

<Visibility>1</Visibility>

<VisibilityMemberType>GlobalGroup</VisibilityMemberType>

<ParentIssueId>0</ParentIssueId>

<Components>

<IssueComponentEN>

<IssueID>16</IssueID>

<IssueComponentID>287</IssueComponentID>

<ComponentID>8</ComponentID>

<DateCreated>2009-07-01T10:46:31</DateCreated>

<TimeStamp>AAAAAAAAC74=</TimeStamp>

</IssueComponentEN>

</Components>

<DateCreated>2008-02-01T01:50:35</DateCreated>

<TimeStamp>AAAAAAAAC8E=</TimeStamp>

</IssueEN>


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

I gave it a shot with curl, and I'm getting a 405 back from the server. Based on context, I think the mention of Resource is to the URI, not the issue resources. Is the URI correct? As far as I can tell from the docs, it's right, but maybe there's something obvious that I'm missing.

> PUT /api/issues.ashx/issues/issuesfull/3104/force/1?format=xml&gemini-username-token=XXX==&gemini-api-token=YYYY== HTTP/1.1
> User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: example.com
> Accept: */*
> Content-Type: text/xml
> Content-Length: 3674
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 405 Method Not Allowed
< Date: Wed, 15 Jul 2009 19:49:11 GMT
< Server: Microsoft-IIS/6.0
< X-Powered-By: ASP.NET
< X-AspNet-Version: 2.0.50727
< Cache-Control: private
< Content-Type: text/xml
< Content-Length: 268
Connection #0 to host example.com left intact
* Closing connection #0
<?xml version="1.0" encoding="utf-8"?><RestError xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Message>Invalid URI - Cannot update Resource as it does not exist</Message><Type>MethodNotAllowed</Type></RestError>


bobw
· 1
bobw
helpful
0
not helpful

Just POST it to the create issue (/api/issues.ashx/issues)


Saar Cohen
· 5000
Saar Cohen
helpful
0
not helpful

See: http://community.countersoft.com/forums/thread/11672.aspx it might help as the Issue class has a toXML method.


Saar Cohen
· 5000
Saar Cohen