Netsuite API post salesorder - api

I'm trying to post a salesorder to Netsuite REST API, and following what appears to be the correct format according to documentation.
I'm posting to /services/rest/record/v1/salesOrder
My payload looks like this
{"recordtype":"salesorder","entity":{"id":"20716"},"total":119.21,"createdDate":"2023-01-25T16:04:59+00:00","item":{"items":[{"item":{"id":"959"},"quantity":1,"amount":111.41}]}}
I'm having no issues connecting and authenticating and am performing other (GET) operations without any issues.
The response to the above request is
stdClass Object
(
[type] => https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1
[title] => Bad Request
[status] => 400
[o:errorDetails] => Array
(
[0] => stdClass Object
(
[detail] => Please enter a value for [entity]
[o:errorPath] => entity
[o:errorCode] => FIELD_PARAM_REQD
)
)
)
The value I have in the 'entity' node is a valid netsuite customer record ID.
For reference, the salesOrder object schema is here - https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2022.2/index.html#/definitions/salesOrder
Any idea why Netsuite is complaining about the entity?

It turns out the format I was posting is correct, but I was posting it in the 'form_data' node rather than the 'body' node.
So for anyone else with similar issue, the payload is correct.

Related

Instagram api response with empty data array

My problem is that i get an empty array from instagram api. i made the app this week and i know its a sandbox app but the problem is that i'm testing it just on my instagram account. i can like my pictures using the api. but i get empty array when i try to get recent tags, follower or followed-by even if i'm using the new scope follower_list
this is the array that i get:
stdClass Object
(
[pagination] => stdClass Object
(
)
[meta] => stdClass Object
(
[code] => 200
)
[data] => Array
(
)
)
Instagram require you to submit your app for "review and approval" to gain access to non-basic permission scopes (eg accessing media from other users).
Their docs on this are here >> https://www.instagram.com/developer/review/

Updating image using Put Request Cakephp Rest API

I am following Cakephp's Rest API docs to implement apis.Cakephp Rest Api Docs
Please note I am using Postman Rest Client to test the apis.
As a requirement I need to provide the users to update a certain product image.
When I use POST Request to add images for the first time, I get the Image information in $this->request->params['form'] array, which also has parameters like name, type, tmp_name, error and size.
[form] => Array
(
[barcode_image] => Array
(
[name] => sitewide%20sales.png
[type] => image/png
[tmp_name] => C:\xampp\tmp\phpFCE8.tmp
[error] => 0
[size] => 136596
)
[image] => Array
(
[name] => phone%20number.png
[type] => image/png
[tmp_name] => C:\xampp\tmp\phpFCE9.tmp
[error] => 0
[size] => 89166
)
)
This can be easily tested in Postman by setting the field type to 'File'(which then lets you upload an image).
Now, I want to let users to Update the image which they had uploaded. For Updating i am using PUT request for which the required MIME type is x-www-form-urlencoded, this then prevents from updating a file.
How can I test updating of image in this scenario.
Will I have to re-write the way i have implemented the API, so that Editing of the image(re-upload a new image) to be done using POST request?
Any help will be greatly appreciated. If I am missing out any specifics, code please ask. I'll update the question accordingly.
I googling for few minutes as per as of your problem. according to my point of you need to understand what is the purpose of PUT & POST.
Just Look at request->is('post') Vs request->is('put')

How to get active listing IDs? GetMyeBaySelling returns no more than 25,000 items

So I want to get all listed items ID's for authenticated user.
To do this I use Trading API GetMyeBaySelling method
Example request:
[ActiveList] => Array
(
[Include] => true
[Pagination] => Array
(
[EntriesPerPage] => 200
[PageNumber] => 89
)
[Sort] => StartTime
)
It works well until I hit magic page 125. Every page after 126, 127, 128, ... returns me 125th page.
So I can get only 25,000 listings. I don't see it mentioned anywhere in documentation.
I also found other people have same/similar issue
Is there any other option to get selelr listing IDs?
Edit: I also asked a question on ebaydev forums
I tried to load 125 pages sorted by time ASC, then load another 125 sorted by time DESC but it doesnt work. Also I am getting this error
[Errors] => stdClass Object
(
[ShortMessage] => Data is truncated.
[LongMessage] => Partial data or invalid summary data is returned due to system limit. Please narrow your requested data and try again.
[ErrorCode] => 21366
[SeverityCode] => Warning
[ErrorClassification] => RequestError
)
I found answer already.
ActiveInventoryReport call from Large Merchant Services is perfect for my needs

Missing Tumblr Followers from result of Tumblr API

I have used this code below to get the followers of a particular user. But there are times that some tumblr blogs are not showing from the response.
$oauth = new OAuth($conskey,$conssec);
$oauth->fetch("http://api.tumblr.com/v2/user/following", array('offset'=>0) ,OAUTH_HTTP_METHOD_GET);
$following_list = json_decode($oauth->getLastResponse());
I am not sure if those blogs have done something to their settings that makes them invisible from the response of the API request.
Anyone experience this kind of problem with Tumblr API requests? How do I go around with this problem for me to view the complete list of followers?
Thank you in advance.
Do you mean you can the array return something like
[response] => stdClass Object
(
[total_blogs] => 29
[blogs] => Array
(
[0] => stdClass Object
(
[name] => papertissue
[url] => http://papertissue.tumblr.com/
[updated] => 1360904405
)
[1] => stdClass Object
(
[name] => lunchbagart
[url] => http://lunchbagart.tumblr.com/
[updated] => 1361159341
)
[2] => stdClass Object
(
[name] => pacegallery
[url] => http://pacegallery.tumblr.com/
[updated] => 1360951263
)
...
[19] => stdClass Object
(
[name] => rulesformyunbornson
[url] => http://rulesformyunbornson.tumblr.com/
[updated] => 1360770089
)
)
)
and you can only see 20 responses right? You will need to run the command again with the offset command and tell it to start at post 21
like this user/following/?offset=21
Basically you can take the value of total_blogs and divide it by 20 to find the number of times to run the command(in a for loop for example) and increase the offset by 20 each time to give you the complete list.
Please let me know if this helps or maybe you meant something else.
I have done the same thing, and noticed that my followers have been over-counted as well. I have sent Tumblr Support an email as well, but they have not gotten back to me.
To know the true number, you can always hand count and account for duplicates. I am lazy (read as: a developer) and just have a Ruby script that does it for me.

Appcelerator Titanium XHR POST params as multi-level array

Ti.SDK 1.6.2
iOS 4.3
I have a web application that receives post data as multi-level arrays.
Array
(
[User] => Array
(
[name] => Josey Morton
[username] => jmorton
[password] => ########
)
[Product] => Array
(
[name] => Pro Drupal Development
[type] => Book
[price] => 49.99
)
)
My serverside app then takes the contents of "User" and "Product" and parses them differently, storing them in their respective databases.
My question:
How can I pass this format as the HTTPClient send params so no adjustment is needed on the server side?
I ended up passing it as a JSON serialized string and decoded the JSON server side. This allowed for the hierarchical post array I required.