Sample Sales Project - REST GET on Customer - Error - MetaClass Order not found

The project is the example project, I downloaded it.
Created a view on the Customer named customer-view
Got an access token via the API.
Using the access token, I send this …

GET http://localhost:8080/app/rest/v2/entities/Customer?view=customer-view

authorization: Bearer 0fee1237-57c5-46ab-9bdf-31f6d2cb20ac
cache-control: no-cache
postman-token: 9cea2f21-af0b-4864-b78d-3039b6788628
user-agent: PostmanRuntime/7.1.5
accept: */*
host: localhost:8080
accept-encoding: gzip, deflate
HTTP/1.1 404
status: 404
cache-control: no-cache, no-store, max-age=0, must-revalidate
pragma: no-cache
expires: 0
x-xss-protection: 1; mode=block
x-frame-options: DENY
x-content-type-options: nosniff
content-type: application/json;charset=UTF-8
transfer-encoding: chunked
date: Thu, 21 Jun 2018 00:44:37 GMT
{"error":"MetaClass not found","details":"MetaClass Customer not found"}

What did I do wrong?

Hi,

The entity name is wrong. It is not customer but rather something like “myapp$Customer“ (depending on your app prefix)…

Bye
Mario

2 Likes

Hi,

In case of the sample-sales application the request must be http://localhost:8080/app/rest/v2/entities/sales$Customer?view=customer-view.

Regards,
Gleb

Works perfect. Looks like the ‘sales’ is whatever the Project Properties Namespace value is.
Thanks!

Hello guys… I am having a problem with my test application… in the Project Properties (MAIN) I have: Name = “IoTMater” and the Namespace = “iotm”.

But I am totally unable to access any REST interface, not even the defaults like: http://localhost:8080/app/rest/v2/entities/iotm$Student.

I always get: {“error”:“MetaClass not found”,“details”:“MetaClass iotm not found”}

I have tried changing the “iotm” to all related values like “IoTMater” and others… but nothing seems to work, the same error is shown with the message like “MetaClass ***** not found”.

Do I need to do something special to enable the basic REST API endpoints for my test project?

Regards,

PS: I also tried with a custom service method exposed through the REST API but still no luck.

Hi,

You can check the entity name in the Entity Designer and try again:

image

If the problem persists, please send us a small demo project so we can investigate the problem.

Regards,
Gleb

I have tried everything… I even checked the swaggerDetailed.yaml and I can see the “iotm$Student” entity and the proper URL… but nothing works.

Here is a set of images with some setup info and results:
Screenshot%20from%202018-11-02%2002-21-11Screenshot%20from%202018-11-02%2002-22-54Screenshot%20from%202018-11-02%2002-21-33Screenshot%20from%202018-11-02%2002-21-47Screenshot%20from%202018-11-02%2002-23-25

Please send us a small demo project so we can investigate the problem.

I built the sample project “sales” and compressed into a zip without the “deploy” folder (to make it smaller).

I tested the REST for entities and the same problems happened.

Here it is…

sample-sales.zip (363.2 KB)

Thanks in advance,

Hey Gleb, sorry for having wasted your time…

This issue was due to a bad REST client (or bad URL encoding to be specific) … the part of the URL endpoint for the name of the entity use the “$” char … so, in that client it was never encoded properly.

Once I tested the REST endpoint in Postman, I got the correct results. So, for the other client I must use something like …/iotm%24Student?view=student-view… and everything works fine too.

Thanks you for your assistance!

Regards,