# Creating objects using the API

**URL:** <https://forum.manager.io/t/creating-objects-using-the-api/7905>\
**Category:** Uncategorized\
**Created:** [November 29, 2016, 12:33pm UTC](https://forum.manager.io/t/creating-objects-using-the-api/7905 "2016-11-29T12:33:33Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![James1](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@James1](https://forum.manager.io/u/James1)\
**Post date:** [November 29, 2016, 12:33pm UTC](https://forum.manager.io/t/creating-objects-using-the-api/7905/1 "2016-11-29T12:33:33Z")

</div>

Hi all,

First off, let me quickly mention how impressed I am with Manager.

Seriously good software.

I am about to launch a number of on-line retail stores and wish to integrate my e-commerce stores with Manager. I have searched the forum but cannot find an example of posting to the API. I have tried posting what I assumed was meant on the journal entry API page however my code is not working.

I was wondering if someone would help point me the right direction?

Here is the basic code I have that does not work.

Thanks and best wishes  
James

```
<?PHP
$data_string = '{"Date": "2016-11-29",
  "Narration": "Test entry",
  "Lines": [
    {
      "Account": "f0dd2220-ef8d-43d0-b2de-d3a2010c0baa",
      "TaxCode": "8cf9d117-3142-4d9c-82ee-b57a0eb2c4809",
      "Credit": 1000.0
    },
    {
      "Account": "68934d51-7382-4f90-a96d-64aa9d2ab543",
      "Debit": 1000.0
    }
  ]
}
';

$ch = curl_init('http://accounts:8080/api/7ca1fcc2-619f-4415-8165-383e7f9e84bc/5ea52bc4-90ae-4e4a-aec4-ef1224b279ad');

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_string))
);

$result = curl_exec($ch);
echo $result;

```

---

<div class="post-metadata">

**Author:** ![James1](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@James1](https://forum.manager.io/u/James1)\
**Post date:** [November 29, 2016, 11:24pm UTC](https://forum.manager.io/t/creating-objects-using-the-api/7905/2 "2016-11-29T23:24:31Z")

</div>

Hi again,  
Please disregard my previous post. It was late and I have since figured out where I was going wrong.

I had not added the authentication information into cURL opts:

curl\_setopt($ch, CURLOPT\_USERPWD, $username . “:” . $password);

I then created a new user within Manager and passed the details to the above line.

@lubos, you really need to put a ‘Donate’ button up somewhere. Once I’ve finished testing the server version, I will buy a copy but would like the ability to donate funds to you to further your efforts, too.

Kind regards,  
James

---

<div class="post-metadata">

**Author:** ![James1](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@James1](https://forum.manager.io/u/James1)\
**Post date:** [November 30, 2016, 12:07am UTC](https://forum.manager.io/t/creating-objects-using-the-api/7905/3 "2016-11-30T00:07:29Z")

</div>

If anyone else is trying to get the API working with PHP, feel free to message me and I’ll happily explain.

---

<div class="post-metadata">

**Author:** ![ShubSingh39](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/shubsingh39/32/23301_2.png) [@ShubSingh39](https://forum.manager.io/u/ShubSingh39)\
**Post date:** [December 4, 2016, 6:06pm UTC](https://forum.manager.io/t/creating-objects-using-the-api/7905/4 "2016-12-04T18:06:45Z")

</div>

How to get all the variables which is used in manager ?

---

<div class="post-metadata">

**Author:** ![Tut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/tut/32/3286_2.png) [@Tut](https://forum.manager.io/u/Tut)\
**Post date:** [December 4, 2016, 6:28pm UTC](https://forum.manager.io/t/creating-objects-using-the-api/7905/5 "2016-12-04T18:28:35Z")

</div>



---

<div class="post-metadata">

**Author:** ![Tut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/tut/32/3286_2.png) [@Tut](https://forum.manager.io/u/Tut)\
**Post date:** [December 4, 2016, 6:28pm UTC](https://forum.manager.io/t/creating-objects-using-the-api/7905/6 "2016-12-04T18:28:45Z")

</div>



---

<div class="post-metadata">

**Author:** ![Tut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/tut/32/3286_2.png) [@Tut](https://forum.manager.io/u/Tut)\
**Post date:** [December 4, 2016, 6:32pm UTC](https://forum.manager.io/t/creating-objects-using-the-api/7905/7 "2016-12-04T18:32:15Z")

</div>

@ShubSingh39, see this guide:

> [@Getting help on the forum](https://forum.manager.io/t/getting-help-on-the-forum/7857):
>
> This forum is the primary source of help on how to use Manager accounting software. It is completely free to users. To use the forum effectively, keep these top ten things in mind: Read the guides. The first forum topic, pinned to the top of the listings, takes you to [guides](https://forum.manager.io/t/guides/7040) that explain many features and functions of Manager. They include helpful illustrations and examples. We are always adding new ones and updating existing ones as capabilities of the program improve. Reading about how the …

Your post was edited to remove personal information. Your question has been answered several times on the forum. Searching on “variables” will turn up previous responses. Basically, all variables are used on built-in themes.

---

<div class="post-metadata">

**Author:** ![macccostello](https://avatars.discourse-cdn.com/v4/letter/m/6de8d8/32.png) [@macccostello](https://forum.manager.io/u/macccostello)\
**Post date:** [December 16, 2016, 4:46pm UTC](https://forum.manager.io/t/creating-objects-using-the-api/7905/8 "2016-12-16T16:46:02Z")

</div>

Hey @James1  
I need some help regarding API with PHP. How can i contact you?

---

<div class="post-metadata">

**Author:** ![Tut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/tut/32/3286_2.png) [@Tut](https://forum.manager.io/u/Tut)\
**Post date:** [December 16, 2016, 4:56pm UTC](https://forum.manager.io/t/creating-objects-using-the-api/7905/9 "2016-12-16T16:56:51Z")

</div>

Send a private message. Click on your avatar in the upper right corner. From there, things are fairly obvious.

---

<div class="post-metadata">

**Author:** ![macccostello](https://avatars.discourse-cdn.com/v4/letter/m/6de8d8/32.png) [@macccostello](https://forum.manager.io/u/macccostello)\
**Post date:** [December 16, 2016, 5:02pm UTC](https://forum.manager.io/t/creating-objects-using-the-api/7905/10 "2016-12-16T17:02:43Z")

</div>

Thanks @tut but it doesn’t show any option to send a message, i can only see my Inbox. Perhaps the Trust Level?

---

<div class="post-metadata">

**Author:** ![Tut](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/tut/32/3286_2.png) [@Tut](https://forum.manager.io/u/Tut)\
**Post date:** [December 16, 2016, 5:16pm UTC](https://forum.manager.io/t/creating-objects-using-the-api/7905/11 "2016-12-16T17:16:50Z")

</div>

Ah, yes. Because you only joined 39 minutes ago…an anti-spamming protection. If @James1 is reading the forum or has notifications set accordingly, though, s/he will see your message and may contact you.

---

<div class="post-metadata">

**Author:** ![Ealfardan](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.manager.io/ealfardan/32/63166_2.png) [@Ealfardan](https://forum.manager.io/u/Ealfardan)\
**Post date:** [January 18, 2023, 3:29pm UTC](https://forum.manager.io/t/creating-objects-using-the-api/7905/12 "2023-01-18T15:29:33Z")

</div>


