Api explorer returning Could not find method named Post or Any

Do all requests from the api explorer come in as posts?

I have a query dto whose only verb is “GET” and I am being told upon calling it from the api explorer
“Could not find method named Post(ItemsQuery) or Any(ItemsQuery) on Service MASServices”

If I put in a service method for AnyAsync it hits it but I want it to be Get Only. I have changed the verbs to be “GET” only as well as all verbs as shown here. Both yield the same results.

Here is the Request class

[Route("/MAS/Items", Verbs="GET,POST,PUT,DELETE", Priority = 0)]
[Route("/MAS/Items/{Id}", Verbs="GET,POST,PUT,DELETE", Priority = 0)]
[Route("/MAS/Items/{CompanyID}/{NamesContains}/{LongDescsContains}", Verbs="GET,POST,PUT,DELETE")]
[NamedConnection("MAS")]
public class ItemsQuery : SPFMBaseQuery<Item>, ISPFMDataQuery<Item>, IReturn<Item>, IJoin<Item, ItemDescription>, IJoin<Item, SalesOrderLine, SalesOrder>, IJoin<Item, PurchaseOrderLine, PurchaseOrder>
{
    public string CompanyID { get; set; }

    public int? Id { get; set; }

    public int[] StatusIn { get; set; }

    //[OrderOfPrecedence(2, ApplyTo = ApplyTo.Get, QueryTerm = QueryTerm.And, ValueQueryTerm = QueryTerm.Or, Field = "NamesContains")]
    public string[] NamesContains { get; set; }

    //[OrderOfPrecedence(2, ApplyTo = ApplyTo.Get, QueryTerm = QueryTerm.And, ValueQueryTerm = QueryTerm.Or, Field = "LongDescsContains")]
    public string[] LongDescsContains { get; set; }
}

Here is the base class.

public abstract class SPFMBaseQuery<T> : QueryDb<T>, ISPFMDataQuery where T : ISPFMDataItem
{
    public virtual bool Summary { get; set; } = true;
    public virtual string[] Children { get; set; } = new string[0];

    public virtual bool CanCancelRequest { get; set; } = false;

    
}

This was working just a few days ago.

Any help would be appreciated. I am working with 6.0.3 from Myget.

Derek

Try adding IGet to your Request DTOs, using the IVerb interface markers is the preferred way to annotate an APIs preferred HTTP method.

Same result. I am going to try creating a new project and work things back in to see where it breaks.

I will get back to you.

1 Like

I can’f figure this out. Every request that comes in from the api explorer is coming in as a post. I thought it might have been that I have a base service class derived from AutoQueryServiceBase so that I could intercept all Queries by overriding Exec and ExecAsync. I changed that to be derived from Service and added Exec and Exec async virtual methods. Still no go.

Can you publish the new project that repro’s the issue on GitHub?

OMG! NOW I CAN’T REPRODUCE IT :slight_smile:

I want to say “don’t look a gift horse in the mouth” and move on. When i put my new project together I will try to be more attentive to what I am puttting where and maybe I can stumble on the answer.

Sorry for the false alarm.

Derek

1 Like