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 9190155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:23:49+00:00 2026-06-17T20:23:49+00:00

I am creating a web application that stores user’s journeys and I’m build this

  • 0

I am creating a web application that stores user’s journeys and I’m build this application in CakePHP 2.2.5.

I have a Journey model and that journey model has many coordinate objects which store the lat long coordinates.

I’d like to send an API call to the journey’s add method containing json in the body to create a new object.

I’ve tried to find out how to format the JSON to allow the controller to use it but I cant seem to find out. I’d also like to know how to add the child objects to the JSON.

I am testing the method using this cURL command

curl -i -H "ACCEPT: application/json" -X POST --data @/home/sam/data.json http://localhost/journeys/add.json

Running this CURL command create a blank entry in the database.

The JSON file included in the CURL contains

{"description" : "Hello World", "user_id":3}
  • 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-17T20:23:50+00:00Added an answer on June 17, 2026 at 8:23 pm

    I’ve done some more research and found a solution to my problem:

    CakePHP will save JSON data and it will also save nested model information.

    $data = $this->request->input('json_decode');
    

    Which is similar to what @Arash said but it will also save nested model information by calling

    $this->Journey->saveAssociated($data)
    

    The JSON I’m providing to the controller looks like:

    {"Journey":
    {"description":"Not even an article from the map", "user_id":3}, 
    "Coordinate":[
        {"lat":54.229149, "lng":-5.114115},
        {"lat":54.39153, "lng":-5.114113}
     ]
    }
    

    Where coordinate belongs to Journey.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a web application that will have many users. Each user has
I am interested in creating a simple web application that will take in user
I've creating one ASP web application, in that application one form have to update
When creating a web application, and lets say you have a User object denoting
I hope this makes sense, but I have an asp.net web forms application that
I have a web application that is based on the users creating certain divs
In my web application I am creating a file that eventually the user will
I have developed a web application driven by a mysql database that stores information
I am creating a web application that lets the user store and retrieve information
I am creating a web application that is accessing a SQLite database in the

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.