Jump to content

Recommended Posts

Posted (edited)

I want to search a title in a database to make sure the record is not already there.   I found the different search types I can do:

    "contenttypes": [
        "core_statuses_status",
        "calendar_event",
        "cms_pages_pageitem",
        "cms_records1",
        "cms_records2",
        "forums_topic",
        "nexus_package_item",
        "links_link"
    ]

What contenttype do I use if I want to search database #3?

Edited by Elon Report
  • Elon Report changed the title to How do I search Databases via API?
Posted
7 hours ago, Stuart Silvester said:

Are you using OAuth tokens? If so, the member you're connecting as most likely doesn't have permission to see the database.

No, I am using REST API.   I tried cms_records3, but that did not work.   

Posted
11 minutes ago, Daniel F said:

 

Are you sure that there's a DB 3? If yes, is it placed on a frontend page?

Yes, there is database 3.   It is not placed on a page - do I need to do that to access the data?

  • Solution
Posted
55 minutes ago, Elon Report said:

 It is not placed on a page - do I need to do that to access the data?

You need a page. The database itself has no url, the page has. If there is no URL, nothing can be accessed or searched.

Posted (edited)
58 minutes ago, Sonya* said:

You need a page. The database itself has no url, the page has. If there is no URL, nothing can be accessed or searched.

That was the solution!   I was able to create records without a url though.

For anyone else that stumbles with this issue:

My database id is 3.   My new page id is 4.

The contenttype is cms_records3

Thanks all.

Edited by Elon Report
Posted (edited)

OK, I am now trying to search actual data, and running into an issue.  Was going to start a new thread but this one was at the top.  🙂

I have a database (#4) on a page, and I am able to upload a record to it.   I can see it on the page. However, I always get no results found via the api.

{{base_url}}?/core/search&q=2&type=cms_records4
{
    "page": 1,
    "perPage": 25,
    "totalResults": 0,
    "totalPages": 0,
    "results": []
}

The title is "2".  I've tried playing with variables but nothing gets returned when there are no filters at all!

Edited by Elon Report
Posted

It is MySQL - but I will look into a elastic server!

That was not the problem.  I changed the title to text, and made the value 00002

Searching produces the same result - none.

Posted
1 hour ago, Sonya* said:

Have you rebuilt search index in ACP? Take a look at core_search_index in your database. Can you see your record there?

Rebuilding solved the problem.  Thanks for the extra troubleshooting tip as well!

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...