I am trying to do CRUD operations on rally using Rally WS with Spring integration.
I am able to retrieve defect but while calling update, it throws error, It is not accepting any type, I tried with MAP, jsonobject.
Map<String, String> updMap =...
updMap.put("_refObjectName", name+" TEST UPDATE");
RallyUpdater updater = ctx.getBean("rallyUpdateGateway", RallyUpdater.class);
String res=updater.updateDefect(updMap);
my configuration:
<int-http:outbound-gateway id="opgateway" request-channel="rallyUpdateJsonRequest"
url="https://rally1.rallydev.com/slm/webservice/v2.0/defect/9792864541?key={key}"
http-method="POST" request-factory="rallyHttpRequestFactory"
expected-response-type="java.lang.String"
reply-channel="rallyUpdateResponse">
<int-http:uri-variable
name="key"
expression="payload" />
</int-http:outbound-gateway>
<int:object-to-json-transformer input-channel="rallyUpdateRequest" output-channel="rallyUpdateJsonRequest" />
<int:gateway id="rallyUpdateGateway" service-interface="rally.RallyUpdater"
default-request-channel="rallyUpdateRequest" default-reply-channel="rallyUpdateResponse" />
When I send a map, I use a transformer . It throws error saying expected '{'.... .
When I send JsonObject, it is throwing another exception.
Which format I should use?
_refObjectName should not be used to set a name of the object. There is a Name attribute, and that's the one that should be used when setting the name.
The curl command below shows a payload example in json format, when updating an existing Rally artifact, e.g. defect:
curl --header "zsessionid:_abc123" -H "Content-Type: application/json" -d"{\"Defect\":{\"Name\":\"New name\",\"Resolution\":\"Not a Defect\",\"State\":\"Fixed\"}}" https://rally1.rallydev.com/slm/webservice/v2.0/Defect/17822920696
I can't comment on Spring specific details, but json should follow format above. However if you choose to use Rally REST toolkit for Java, you do not have to manually build a payload like that since the toolkit provides convenience methods
Related
So basically I need to use the update/revise Rest API to update the fields in the vTiger CRM.
But when I am using the rest API (link : https://help.vtiger.com/article/147111249-Rest-API-Manual) to update the fields, I am getting the error as "400 Unsupported operations: The request cannot be fulfilled due to bad syntax."
My api : endpoint/reviseelement=convert_into_json_string({id:5x369, potentialname:'demo2'})
Also apart from this, I had used the SQL query Rest API, to update the record in the modules, but it is also giving me the same error as: "400 Unsupported operations: The request cannot be fulfilled due to bad syntax."
My Api query : endpoint/query?query=UPDATE Potentials SET potentialname = 'demo2 where id = 5x369;
Also by using the webservice(https://community.vtiger.com/help/vtigercrm/developers/third-party-app-integration.html) rest api I am getting error like : "Permission to perform the operations is denied for id: ".
So how can I use the update api. Can anyone please help?
For web services API (https://community.vtiger.com/help/vtigercrm/developers/third-party-app-integration.html),
When you pass the payload data, make sure you're passing the x-www-form-urlencoded form of data.
Also, make sure you're passing 'element' argument with value like this:
{"id": "10x11471458", "leadsource": "Facebook"}.
if you're still facing this issue, you can share more details and I'll be happy to help you.
If you still need to do this the following should work.
Method: POST
End Point: /revise
Headers: "Authorization: Basic YOUR_TOKEN"
Body:
{
"element": {
"id":"5x369",
"potentialname": "demo2"
}
}
reference: https://www.vtiger.com/docs/rest-api-for-vtiger#/Revise
I am generating API documentation for our Java endpoints. I am using widdershins to convert our openAPI3.0 yaml file to markdown. Then, I am using shins to convert the markdown file to html. The request body for all of our endpoints does not appear in the generated cURL examples. Why is this? This defeats the purpose of having cURL examples because copying and pasting a cURL example without the required body will not work. Can anyone recommend a workaround or alternative tool that generates good documentation with complete cURL examples?
Example endpoint from our openAPI.yaml file...
post:
tags:
- Tools
description: Installs a tool on a user's account
operationId: Install Tool
requestBody:
description: UserTool object that needs to be installed on the user's account
content:
application/json:
schema:
$ref: '#/components/schemas/UserTool'
required: true
parameters:
responses:
default:
description: default response
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
This is the documentation our toolchain generates from this yaml file...
We would like to add a line just like the one below (grey highlight) to our cURL examples. This is a chunk from the markdown file that Widdershins produces from our openAPI yaml file. I manually added the –“d
This stack overflow Q/A suggests the answer is it is impossible to include a body parameter in a code example using swagger or openAPI. Is this correct? If so, why is this the case? What's the reasoning?
Cheers,
Gideon
I also had the same problem.
As a result of trial and error, it was found that the behavior displayed on curl varies depending on the in value.
Please look at the ParameterIn enum.
public enum ParameterIn {
DEFAULT(""),
HEADER("header"),
QUERY("query"),
PATH("path"),
COOKIE("cookie");
I tried by like below at first time:
new Parameter().name("foo").in(ParameterIn.HEADER.name())
But name return like "HEADER", So swagger(or OpenAPI) recognized to header.
It should be lower character like "header" follow ParameterIn enum.
So, you can fix it like this
new Parameter().name("foo").in(ParameterIn.HEADER.toString())
or
new Parameter().name("foo").in("header")
I also encountered the same problem and I did a little digging. It turns out I had to set options.httpSnippet option in widdershins to true so that the requestBody params will show up. However, setting that to true just shows the params if content type is of application/json. For multipart-form-data, you need to set options.experimental to true as well.
Unfortunately, there is a bug in widdershins for handling application/x-www-form-urlencoded content-type.. I created a PR for it which you can probably manually patch on the widdershins package. PR link: https://github.com/Mermade/widdershins/pull/492/files
I am trying to test GitHub API and explore it's different endpoints. I have the different possibilities which are returned by let's say the initial get request on https://api.github.com.
The returned list is:
{
"current_user_url": "https://api.github.com/user",
"current_user_authorizations_html_url": "https://github.com/settings/connectio ns/applications{/client_id}",
"authorizations_url": "https://api.github.com/authorizations",
"code_search_url": "https://api.github.com/search/code?q={query}{&page,per_pag e,sort,order}",
"commit_search_url": "https://api.github.com/search/commits?q={query}{&page,pe r_page,sort,order}",
"emails_url": "https://api.github.com/user/emails",
"emojis_url": "https://api.github.com/emojis",
"events_url": "https://api.github.com/events",
"feeds_url": "https://api.github.com/feeds",
"followers_url": "https://api.github.com/user/followers",
"following_url": "https://api.github.com/user/following{/target}",
"gists_url": "https://api.github.com/gists{/gist_id}",
"hub_url": "https://api.github.com/hub",
"issue_search_url": "https://api.github.com/search/issues?q={query}{&page,per_ page,sort,order}",
"issues_url": "https://api.github.com/issues",
"keys_url": "https://api.github.com/user/keys",
"notifications_url": "https://api.github.com/notifications",
"organization_repositories_url": "https://api.github.com/orgs/{org}/repos{?typ e,page,per_page,sort}",
"organization_url": "https://api.github.com/orgs/{org}",
"public_gists_url": "https://api.github.com/gists/public",
"rate_limit_url": "https://api.github.com/rate_limit",
"repository_url": "https://api.github.com/repos/{owner}/{repo}",
"repository_search_url": "https://api.github.com/search/repositories?q={query} {&page,per_page,sort,order}",
"current_user_repositories_url": "https://api.github.com/user/repos{?type,page ,per_page,sort}",
"starred_url": "https://api.github.com/user/starred{/owner}{/repo}",
"starred_gists_url": "https://api.github.com/gists/starred",
"team_url": "https://api.github.com/teams",
"user_url": "https://api.github.com/users/{user}",
"user_organizations_url": "https://api.github.com/user/orgs",
"user_repositories_url": "https://api.github.com/users/{user}/repos{?type,page ,per_page,sort}",
"user_search_url": "https://api.github.com/search/users?q={query}{&page,per_pa ge,sort,order}"
}
Is there a way into Postman, or follow up facilitators to generate a collection from these?. Some scripting will be necessary for sure to follow Postman Json Collection format.
If there is a solution other than Postman completely that fits in this issue, I am all ears.
What I did:
I tried to search for some GitHub API as a Postman Collection, I
didn't find any.
I tried to understand Postman Json Collection format, which is not so easy for me to write some script to create one. Maybe someone did?
I can "find and replace : "([a-z_])*": with curl -H "Authorization: token ####". Is there a way to integrate the whole to Postman?
I can't help it unless I consume a lot of effort. But also, I may be stuck other times as I'm exploring advanced API capabilities, techniques, and choices not only for GitHub API. So this won't be the last.
I tried to insert a dataset using a DataAccessor from jena withL
DatasetAccessor authAcc = DatasetAccessorFactory.createHTTP("http://192.168.56.101:8890/sparql-graph-crud-auth", auth);
authAcc.putModel("oole:g1",dataset.getDefaultModel());
But it does not seem to work, I also tried to PUT the same file using curl and I spotted a difference in the HTTP header.
From jena:
PUT /sparql-graph-crud-auth?graph=oole:g1 HTTP/1.1
While from curl doing:
curl --digest --user usr:pwd --verbose --url "http://192.168.56.101:8890/sparql-graph-crud-auth?graph-uri=oole:g1" -T file.ttl
I get:
PUT /sparql-graph-crud-auth?graph-uri=oole:g1 HTTP/1.1
The difference seems to be graph-uri as oppsed to graph. Is there any way i can still use the DataAccessor from Jena?
DatasetAccessor is the API to the SPARQL Graph Store Protocol and there it says graph=. This is wired into DatasetAccessorGraphHTTP.
Being open source, if you need something different you could take a copy of that one class, modify it locally (method DatasetAccessorGraphHTTP.target) to have your own implementation.
It is all built on top of some HTTP convenience code in HttpOp which you could call directly but your own modified DatasetAccessorGraphHTTP looks to be less work.
I am trying to retrieve the results of a Salesforce Report programmatically.
Often referenced is this blog about scraping the results from the web side, but the method is unsupported: http://sfdc-heretic.warped-minds.com/2006/04/10/progmatic-access-to-salesforcecom-reports/.
I can get a list of reports via the REST api:
require 'restforce'
restforce_client = Restforce.new(
:refresh_token => <refresh token>,
:client_id => <client id>,
:client_secret => <client secret>
)
reports = restforce.query("SELECT Id,DeveloperName FROM Report")
reports.last.DeveloperName
=> "Rob_Test_Report"
I've also tried retrieving via the Metadata SOAP API ReportFolder object:
require 'metaforce'
metaforce = Metaforce.new(
:username => <username>,
:password => <password>,
:security_token => <security token>
)
report_folders = metaforce.list_metadata('ReportFolder')
report_folders.last.full_name
=> "RobTestReportFolder"
I can see the folder. I haven't retrieved the contents yet but even when I do it seems that I would just be getting the metadata around the report itself (i.e. the filter criteria), not the results of the report. The metadata api is discussed here: https://success.salesforce.com/questiondetail?qId=a1X30000000IQ8pEAG. Is this correct?
I saw this similar question from a couple years ago but did not know if it was correct or anything had changed in the API:
How to I access reports programmatically in SalesForce using Apex
Is it possible to export or pull the results of a Report through a supported Salesforce API?
You cannot retrieve the results of a report without using the Analytics API, which as of the Summer '13 release will be available only as a pilot. If you want to participate in the pilot, let me know and I will submit your request.
Once in the Pilot, you use a REST endpoint passing in the Id of the report. You will have two endpoints-- a describereport endpoint and a runreport enndpoint. What is returned from describeReport is a JSON representation of the metadata for the report (describes the dimensions and facts and such) and from runReport a JSON representation of the data.
Once you have the data you can do with it what you will. The report data is only available at the summary level and for the pilot only summary and matrix reports are supported.
I'm not aware of any programmatic way to do that. Conga app could be one option but I believe they get the filters from the report's metadata and construct a matching SOQL query...
The blog post you've mentioned should work. You probably missing something like setting session id in cookie.
Hack, error-prone, web-scraping way would be to use something similar to trick I did with Apex: https://salesforce.stackexchange.com/questions/4303/scheduled-reports-as-attachment. Theoretically you'd be able to pull off similar thing from any other API access as long as you have the user's session Id (whether passed from logged in session or generated yourself from SOAP login call...)
Do also check out metadaddy's answer to my related question: https://salesforce.stackexchange.com/questions/4692/screen-scrape-salesforce-with-rest-get-call-from-apex