Partner Zone
Partner Zone

Essentials API - Create CONTACT 500 Internal Server Error

This thread is now closed to new comments.
Some of the links provided in this thread may no longer be available or relevant.
If you have a question please start a new post.
3 REPLIES 3
Partner databuzz
5 Posts
Partner
Australia
databuzz
Partner

5Posts

0Kudos

0Solutions

Re: Essentials API - Create CONTACT 500 Internal Server Error

Thanks Keran,

 

It looks like the missing Content-Type: application/json header was the issue. I was setting a header for Accept: application/json but not the content type.

 

All working well so far in my tests.

 

thanks,

Andrew

Former Staff KeranM
299 Posts
Former Staff
Australia
KeranM
Former Staff

299Posts

94Kudos

56Solutions

Accepted Solution Solved Solution

Re: Essentials API - Create CONTACT 500 Internal Server Error

Hey there

 

Can you try the following for me - as I think I might have spotted what's happening - a mix of bad JSON and the wrong content type in your headers

 

Use this JSON (note that I've included the TYPES detail)

 

{
  "name": "Jones Grocery Supplies",
  "types": [
    "Supplier"
  ],
  "lastName": "Jones",
  "firstName": "Ted",
  "active": "true",
  "individual": "false",
  "notes": "test"
}

Make sure that your headers include the following, particularly the content type as I find it'll return 500 Internal Error if Content Type is not explicitly set

Content-Type: application/json
Authorization: Bearer {YOUR TOKEN HERE}
x-myobapi-key:{YOUR API KEY}
x-myobapi-version: v0

I have tested that and have it working now ... and if you can test that and get it working, I'll tell the engineering team that there is an issue when Content-Type isn't set correctly.

 

Hope that helps

 

 

Btw - You can post MUCH more data too - here's an example of a full customer

{
  "name": "Bob's Supplies",
  "types": [
    "Supplier"
  ],
  "firstName": "Bill",
  "lastName": "Smith",
  "phone": "12341234",
  "fax": "98679876",
  "position": "Manager",
  "notes": "This is a contact note",
  "mobile": "1111 1111",
  "email": "bob.smith@example.com",
  "abn": "80000000001",
  "ird": "",
  "reportable": false,
  "active": true,
  "individual": false,
  "shippingAddress": {
    "addressLine1": "12 Wesley Crt",
    "addressLine2": null,
    "suburb": "Burwood East",
    "state": "VIC",
    "postCode": "3151",
    "country": "Australia"
  },
  "billingAddress": {
    "addressLine1": "12 Spooner Street",
    "addressLine2": null,
    "suburb": "Melbourne",
    "state": "VIC",
    "postCode": "3000",
    "country": "Australia"
  },
  "website": "http://www.bob.smith.com",
  "customerBalance": 140.00
}

 

Keran McKenzie
Futurist in residence @MYOB

Are you a developer? Check out http://developer.myob.com
Looking for an Add-on? Check out http://myob.com/addons/

Twitter: @myobapi | @keranm
Former Staff KeranM
299 Posts
Former Staff
Australia
KeranM
Former Staff

299Posts

94Kudos

56Solutions

Re: Essentials API - Create CONTACT 500 Internal Server Error

Hi there

I've just been doing some testing on this and I too am hitting the 500 Internal Server Error.

I'm raising this directly with the engineering team now ... lets see what's going on

K.
Keran McKenzie
Futurist in residence @MYOB

Are you a developer? Check out http://developer.myob.com
Looking for an Add-on? Check out http://myob.com/addons/

Twitter: @myobapi | @keranm
Highlighted
Partner databuzz
5 Posts
Partner
Australia
databuzz
Partner

5Posts

0Kudos

0Solutions

Solved: Go to Solution

Essentials API - Create CONTACT 500 Internal Server Error

I'm working with the Essentials API and can successfully authenticate and GET Businesses, Items, Contacts, Invoices etc. I'm having an issue with doing a POST to create a new record, such as an Item or Contact - I keep getting a 500 Internal Server Error response.

 

This has been asked elsewhere but I haven't been able to find a post with a solution, such as this one:

 

http://community.myob.com/t5/AccountRight-and-Essentials-API/MYOB-Essentials-API-Can-t-create-new-co...

 

I'm setting the headers correctly and POSTing a simple request like this:

 

{ "name":"Jones Grocery Supplies","lastName":"Jones","firstName":"Ted","active":"true","individual":"false","notes":"test"}

 

If anyone can spot what I'm doing wrong that would be greatly appreciated.

 

thanks

Didn't find your answer here?
Try using advanced search to find a post more easily Advanced Search
or
Get the conversation started and make a new post Start a Post