Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9240093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:07:48+00:00 2026-06-18T08:07:48+00:00

I have a request where most of the input parameters are put in as

  • 0

I have a request where most of the input parameters are put in as a JSON request object. For documentation purposes, I want to specify the most common fields that a user can put in but there is a lot of variability to the name values that would go into the JSON request and I don’t want to document all of these as it would be cumbersome.

Here’s a screenshot of what I have now:

API in Explorer

As an example if I wanted to put in a JSON property called “people-with” and set it to “[‘joe’,’paul’,’jane’] then that would be easy to do in the JSON but how would I pick that up in my PHP/Restler code. Right now the signature for this service is:

/**
 * ADD an Activity
 *
 * Add a new action to a user's stream
 *
 * @url POST /{user_id}
 *
 * @param integer   $user_id    The user_id for whom the actions apply; you can insert the text "self" and it will resolve to the current/default user
 * @param string    $start_time {@from body} The date/time that the activity was started (YYYY-MM-DD or YYYY-MM-DD HH:mm:SS)
 * @param string    $action     {@from body} The action "slug name" that uniquely identifies an action
 * @param string    $end_time   {@from body} The date/time that the activity concluded (YYYY-MM-DD or YYYY-MM-DD HH:mm:SS)
 * @param string    $app_id     {@from body} The application that captured this activity
 * @param string    $proxy_user_id  {@from body} The person who captured this activity for the individual
 * @param string    $location   {@from body} The location information associated with this activity
*/
public function add_action ($user_id, $start_time, $action, $end_time=null, $app_id=null, $proxy_user_id=null, $location=null)
{
    // implement
}

p.s. as a side note, I’ve temporarily changed this API service to a PUT to avoid the POST issue that was raised a few days ago which is effecting me here too while using POST.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T08:07:49+00:00Added an answer on June 18, 2026 at 8:07 am

    Ok, key to solving this lies in the $request_data associative array. So in order to achieve both the documentation (of key fields) and being able to dynamically receive values into the POST/PUT service you just need to do this:

    /**
     * ADD an Activity
     *
     * Add a new action to a user's stream
     *
     * @url PUT /{user_id}
     *
     * @param integer   $user_id    The user_id for whom the actions apply; you can insert the text "self" and it will resolve to the current/default user
     * @param string    $start_time {@from body} The date/time that the activity was started (YYYY-MM-DD or YYYY-MM-DD HH:mm:SS)
     * @param string    $action_nm  {@from body} The action "slug name" that uniquely identifies an action
     * @param string    $end_time   {@from body} The date/time that the activity concluded (YYYY-MM-DD or YYYY-MM-DD HH:mm:SS)
     * @param string    $app_id     {@from body} The application that captured this activity
     * @param string    $proxy_user_id  {@from body} The person who captured this activity for the individual
     * @param string    $location   {@from body} The location information associated with this activity
    */
    public function add_activity ($user_id, $start_time, $action_nm, $end_time=null, $app_id=null, $proxy_user_id=null, $location=null, $request_data=null)
    

    Note that there is no @param for $request_data but that $request_data is now hanging at the end of the function signature. Now imagine I had passed the following 'test' : 'me' in the request’s JSON. Now I can get that in my handler at:

    echo $request_data['test']; // prints "me"
    

    This works and the documentation looks as it’s supposed to as well (see screen shot above).

    One final note, for those who are curious, you can access ALL your JSON variables through the $request_data array. So that means that:

    echo ($request_data['user_id'] === $user_id); // TRUE
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an HTTP Request Dispatcher class that works most of the time, but
I have a request controller that is getting out of hand, and I want
I have 100 web servers and noticed that some of them have request filtering
I have a request in from a client that would like one of their
I have ajax request that do 3 missions: Save Model (DB) Send Email Give
I have a request that returns a large xml file. I have the file
I have a windows forms application that I am adding a request support form
I have a form that submits a large number of inputs... <input type=hidden name=searchTag_happy
We all know that App Engine limits you to 1 MB for most input/output
I have a railsCombobox() plugin that I have implemented...it actually connects to an input

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.