• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Pass an ID to API Manager Resource

Explorer ,
Feb 19, 2018 Feb 19, 2018

Copy link to clipboard

Copied

As it is standard practice to send an ID to RESTful APIs by referring to the object type, followed by the ID...

e.g. http://example.com/products/3484909

would normally bring me back data for the product with ID 3484909.

I can't seem to get API Manager to take this kind of argument, though. It's not a major issue, but it would appear the only thing I can do is call the following:

http://example.com/products?id=3484909 to get the desired result

With many platforms you can specify a variable to accept when identifying a route or resource but it doesn't appear there is any way to do this with API Manager. Has anyone seen anything like this or know a away around it?

Views

239

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Feb 19, 2018 Feb 19, 2018

I figured this one out. If you define a resource as a GET resource, and then define a separate GET resource with the parameterized value, it works. For example, the first resource was defined as follows:

GET => /publications

So, if the user sends a get request to http://example.com/publications this returned all publications. The second one is defined as follows:

GET => /publications/{id}

So, if the user sends a get request to http://example.com/publications/23423 this will now return the data for t

...

Votes

Translate

Translate
Explorer ,
Feb 19, 2018 Feb 19, 2018

Copy link to clipboard

Copied

LATEST

I figured this one out. If you define a resource as a GET resource, and then define a separate GET resource with the parameterized value, it works. For example, the first resource was defined as follows:

GET => /publications

So, if the user sends a get request to http://example.com/publications this returned all publications. The second one is defined as follows:

GET => /publications/{id}

So, if the user sends a get request to http://example.com/publications/23423 this will now return the data for the publication with that specified ID.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation