How to post json object for existing item screen by using rest service, iam getting response from some 3rd party tool - acumatica

string entityAsString = sr.ReadToEnd().ToString().Replace("{0}", Convert.ToString(root.CategoryID.value)).Replace("{1}", root.Name.value);
can i post the data like this, is there any other way to post the data to item screen please tell me.

Deepika, Have you looked at the wrapper in github? https://github.com/Acumatica/AcumaticaRESTAPIClientForCSharp
This project does all the heavy lifting interfacing with the api for you. Perhaps, even if you didn't use the project, it would explain how to post the data properly.
Also it is being maintained by Acumatica so its always current.

Related

Post using modRestController Class at MODX

I am developing a modx RESTful API. I would like to ask, if anyone knows how to post directly from browser to modRestController class and finally with this post I can save the information to the database.
I believe this two posts will help you:
You need to create proper REST API files&folders structure
Implement custom database logic
Call 2 in 1

I need to scrape all the analytics from a Flurry account

Right now, the only project I can see that does this is
https://github.com/lucamartinetti/flurry-scraper
...but it currently is not logging in properly, I suspect that this is do to the fact that Flurry has made changes to their API which result in the login not working anymore...
I tried messing with it, but am unable to get it to work.
Can anyone help me, or point me in the direction of a project that will do this? I want to scrape all the data possible and download it.
Any help would be appreciated.
Thanks,
-Mark
You don't need to scrape the website if all you want is analytics metrics of your app and you have the API key.
You just need to access this data using Flurry's reporting APIs.
For instance, you can make a REST call to the AppMetrics API and it would give you data about about your apps' users, sessions, pageviews, etc in XML or JSON. A simple AppMetrics call would be of the form:
http://api.flurry.com/appMetrics/METRIC_NAME?apiAccessCode=APIACCESSCODE&apiKey=APIKEY&startDate=STARTDATE&endDate=ENDDATE&country=COUNTRY&versionName=VERSIONNAME&groupBy=GROUPBY

Posting Blog Entries to a Community

Our tool is submitting blog entries to the idation blog for a configured community by using the Connections API.
Therefore, I use the following workflow, given only a community ID:
1) query /blogs/api/blogs?commUuid=<ID_HERE>&blogType=ideationblog
2) retrieve the link to the communities ideation blog from the xml result of aboves query. the xPath for this is "/app:service/app:workspace/app:collection[a:category[#term='entries']][1]/#href"
3) post the created blog entry payload to this url.
This all worked fine in our environment. However, when I deployed this at a customer, it did not work anymore. The url from the first step returns an empty xml document, and the following steps thus cannot be executed. I tried to query different urls on the customers server like /blogs/{homepageHandle}/api/blogs?commUuid=&blogType=ideationblog which work fine, however the query to the api service document above is the only one which contains the collection element with the link I need.
Is there any other API call I can do, to get this url? Do you know of any reason, why the call is working just fine in our environment, but fails at the customer? Might this be an access rights problem?
I am aware, that I could probably just create a url like "blogs//api/entries" and post to it, however I would prefer the above way, since I only have the communityUuid configured, and also because it is exactly the way that the API Documentation describes:
http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+API+Documentation#action=openDocument&res_title=Creating_blog_posts_ic45&content=pdcontent
ServiceDoc -> Collection -> href
UPDATE:
This might be a problem with the SBT really. My assumption, that an empty xml document was returned was wrong, it is rather that calls via the SBT Endpoint classes are returning null.
Endpoint endpoint = EndpointFactory.getEndpoint("connections");
Object result = endpoint.xhrGet("/blogs/api"); // also tried for /blogs/<homepage>/api
When I again tried those URLs in the Browser, I got the complete results. Problem with all this is, that I can neither reproduce this in our own environment nor am I able to debug this at the customer. I tried to catch possible exceptions from this, but none are thrown. It's just that the result is null.
To clarify: The same requests work perfectly fine in our own (Connections 4.0) environment, and also from the browser at the customer. I am of course using the same user to authenticate as well in the browser as in the API calls.
endpoint.isAuthenticationValid();
also returns true, so seemingly no problem there...
I have long ago given up trying to follow the IBM documented REST API instructions (not least of all because it always ends in a myriard of REST requests just to get to the URL I need to send my request to).
I tried both your URLs (/blogs/api/blogs?commUuid=... and /blogs/<homepage>/api/blogs...) against all our Connections 4.5 systems, but although I do get an xml document back it doesn't contain a reference to the ideationblog anywhere (and yes, I made sure to quest against a Community that does contain an ideation blog).
This is a dirty workaround, which you mentioned you did not want to do, but which I do use because the documented way doesn't work:
To post blog entries, you need to POST against
/blogs/<bloghandle>/api/entries
To find out the handle (<snx:handle>) of the ideation blog in your community, you can do the following:
1.) Get the widgets-feed for the community: /communities/service/atom/community/widgets?communityUuid=...
2.) Navigate to the entry of the Ideation Blog widget: <snx:widgetDefId>IdeationBlog</snx:widgetDefId>.
Unless someone in your customer system has messed with the widgets-config.xml, the widgetDefId will be IdeationBlog.
3.) Take the <snx:widgetInstanceId> text of the Ideation Blog entry.
That is the handle of your ideation blog. (Yes, community ideation blogs are created with the widgetInstanceId of the Ideation Blog widget as handle. Normal blogs are created with some mashup of their title as handle). You can now construct the URL to post the entries to.

Using Rally's REST API to retrieve User Stories for a project

I am tyring to retrieve the details of all User Stories for a specific project. I am using the REST URL:
https://rally1.rallydev.com/slm/webservice/1.34/hierarchicalrequirement?project={Rally_REST_URL_for_the_project}&fetch=true
I am using JAXB to unmarshal the XML response. However, the result consists of objects of type DomainObjectType and hence I cannot cast them into HierarchicalRequirementType - in fact the data pertaining to User Stories are not retrievable.
Is there any other way of doing this? I got the XML Schema from the Rally Help pages, and I do not see any way to do it other than make N+1 requests - which I would like to avoid.
Any help will be appreciated.
kind of roundabout answer - we have a beta/labs Java REST toolkit you could try here: http://developer.rallydev.com/help/java-toolkit-rally-rest-api
That might be worth a try to help move some of that along.
I have contacted Rally support for a validation of their XML Schema. Will post again once they get back to me.
--A few days later--
Thanks to everyone for their efforts.
Apparently, the XML Schema is meant for SOAP and not REST, although it can be used for REST too in some cases.
I have to modify Schema for my requirement - something I am working on now.

How to use the Spotify Apps API objects?

The new Spotify Apps Javascript API contains a number of objects like Album, Library, Link etc. But how do you actually instantiate and use any of them in your app?
I've looked at the tutorial app but all that is used there is the trackPlayer object which isn't documented as far as I can tell.
The answer to this question suggests looking in the in the app bundle at Spotify.app/Contents/Resources/cef_views. However, I can't seem to find this on my Mac and there seems to be no corresponding folder on Windows.
Any help would be greatly appreciated.
First, to answer your second question about where to find the folder (I also posted this as a comment in my own original post):
In Windows the folder is located as a .zip file (resources.zip) in the data folder next so Spotify.exe. In my case this is
C:\Users\buchetics\AppData\Roaming\Spotify\Data\resources.zip
On the Mac, you need to right click Spotify.app and select Show Package Content (or something like that), then you can navigate to the folder inside the bundle.
Ok, now to your original question. You can get the API objects like this:
window.Models = sp.require("sp://import/scripts/api/models");
window.Views = sp.require("sp://import/scripts/api/views");
Then, you can use all the methods and properties as described in the API reference (which is still not very good).
For example:
window.CurrentPlaylist = new Models.Playlist();
var track = Models.Track.fromURI("spotify:track:4n6AGL10M8fbm8oHxhK16j");
CurrentPlaylist.add(track);
And so on. The Models API is quite easy to use and the Views object can be used to render a track list similar to the regular Spotify lists. For other API calls, such as getting the current playing track, you need to use the core API which is returend by var sp = getSpotifyApi(1);. However, there is no documentation for this yet and the best advice is to look at the code found in cef_views or use the Inspector on the available apps to find useful code pieces (not all of the apps expose their code in a way to easily look at it, but some do, such as the "We are Hunted" or "Songkicks" app).

Resources