Socrata and DELETE request - socrata

I have recently found out how to delete rows by ID with the SODA API, but all of them were done through HTTP POST requests.
Whenever I use DELETE requests, no matter what content is sent, it deletes the entire contents of my database. On the documentation page for direct Direct Row Manipulation, the sample request for HTTP DELETE (application/json) does not work:
[
{
"typ": "delete",
"id": "row-evac~sxbs~gm8t"
}
]
Is the DELETE part of the SODA API functioning correctly? Or is the POST request the preferred choice?

As is described on http://dev.socrata.com/publishers/direct-row-manipulation.html, you just need to issue the following request, replacing <ROW IDENTIFIER HERE> with the row identifier of the row you wish to delete.
DELETE /resource/hgqn-vki9/<ROW IDENTIFIER HERE>.json HTTP/1.1
Host: soda.demo.socrata.com
Authorization: Basic [REDACTED]
X-App-Token: [REDACTED]
For example, to delete this row: soda.demo.socrata.com/id/4tka-6guv/00388609.json (the row identifier is "00388609") you would issue the DELETE request to: https://soda.demo.socrata.com/id/4tka-6guv/00388609.json

Related

List GitHub Repo Names

I am trying to get a list of GitHub Repo names for my organisation.
Using Postman I have used:
GET https://api.github.com/orgs/ORGNAME/repos
This responds with all of the data for each repo. Is there a way to just return the repo names?
Thanks!
It's not possible with the REST API. You need to use their GraphQL API to fetch specific fields.
With the REST Api you will always get the full dataset, but with Graphql you can query your way around to fetch only what you need. here is a sample :
To fetch the data in graphql the method must be POST, put the base url https://api.github.com/graphql
in the body of the request select GraphQL. and add the following query in QUERY:
query MyQuery {
nodes(ids: ["#node_id"]) {
... on Organization {
repositories(first: 10) {
nodes {
name
}
}
}
}
}
PS: replace node_id with your org node_id
in Authorization tab select TYPE Bearer Token and add your Github access token(https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)

Copy as Response body dynamic value in xml

When working with XML responses I dont have the option to Copy as Response body dynamic value?
Is this facility only available with JSON?
UPDATE-1:
Can't seem to get it working
I can add the Request object but the Key Path (dotted xpath) to the desired data is not giving the expected results. I am using "plan.link"
So the xml is like this
<plan>
<id>7286</id>
<piuid>1</piuid>
<title>Bollard Positions</title>
<link>http://<my-server-name>/port/1/plan/7286.gif</link>
</plan>
And I want to pick the url from the link element (plan.link)
But Paw is not reading right and changes the request to
GET / HTTP/1.1
Host: echo.paw.cloud
Connection: close
User-Agent: Paw/3.1.3 (Macintosh; OS X/10.11.6) GCDHTTPRequest
I'm doing something wrong but not sure what.
Any suggestions?
That's true, sadly you cannot just right-click and pick Copy as Response Body Dynamic Value for XML responses (only works for JSON and Form URL-Encoded).
Though, you can manually set a dynamic value to point to this field.
Right-click on a field where you want to insert this reference, and choose Response > Response Parsed Body
Enter the Key Path to the node you want to select, and end it with the text key to access the string's value.
Should be a working reference. You can have the preview below.

Get users for a given group Activiti Rest API

I'm looking for some advice on how to approach retrieving the users from a given group of the activti-app. Having read the documentation I've attempted to hit the endpoint associated with users and their groups by a posting a JSON body containing an array of user task filter ids.
Testing this in Postman returns a 500 internal server error "exception": "Request method 'POST' not supported". Obviously this is because I should be making a GET request however I cannot attach a JSON body in that case.
Aforementioned example endpoint: localhost:8080/activiti-app/api/enterprise/groups/{group_id}/users
Aforementioned docs:
https://docs.alfresco.com/activiti/docs/dev-guide/1.5.0/#_user_and_group_lists
Specifically this section Screencap of activti docs
Any suggestions would be greatly appreciated!
Thanks!
First, we have to make sure we are talking about "organization groups" not "capabilities groups". That was my original confusion. Once I create the right kind of group I could successfully use the REST API to fetch both a list of groups and a list of group members.
As the docs point out, to get a list of groups, do this:
curl -uadmin#app.activiti.com http://localhost:8080/activiti-app/api/enterprise/groups
Which returns:
{
"size":2,
"total":2,
"start":0,
"data":[
{"id":5,"name":"test-org-group-1","externalId":null,"status":"active","groups":null},
{"id":6,"name":"test-org-group-2","externalId":null,"status":"active","groups":null}
]
}
If you want to pass a filter, do it with "?filter=some-group-name".
Now, to see the members of a specific group, pass in the group ID, which is a numeric. So to see the members of test-org-group-1 I would use:
curl -uadmin#app.activiti.com http://localhost:8080/activiti-app/api/enterprise/groups/5/users
Which returns:
{
"size":2,
"total":2,
"start":0,
"data": [
{"id":2,"firstName":"Test","lastName":"User1","email":"tuser1#metaversant.com"},
{"id":3,"firstName":"Test","lastName":"User2","email":"tuser2#metaversant.com"}
]
}

Cannot Get item form dynamodb using aws proxy in aws api gateway?

i am working with dynamodb to insert and retrieve records from dynamo. please note that when i insert the record to dynamo db it is working fine but when i try to list any item or retrieve any item from dynamodb it return no result found
for retrieving of record
created a iam role which has trust relationship with api gateway. and has managed policies : AmazonAPIGatewayInvokeFullAccess , AmazonDynamoDBFullAccess , APIGatewayAWSProxyExecPolicy , AmazonAPIGatewayAdministrator.
created a table named, emp which has the field ID and name.
created an api gateway named emp, which has resource /employee. and has method post and get. post for insert and get for display record.
for get method selected aws service proxy
then in URL Query String Parameters added id in method request.
then also in integration request > URL Query String Parameters added > ID and method.request.querystring.id.
in integration request > body mapping template added application/json and then the json code
{
"TableName": "emp",
"KeyConditionExpression": "ID = :v1",
"ExpressionAttributeValues": {
":v1": {
"S": "$input.params('ID')"
}
}
}
then when i tested it it returns no result I cannot figure out why please help.
I'm not an expert on this, but I can see two issues.
First in the DynamoDB service proxy settings the HTTP method needs to be POST, as you are POSTing a request to DynamoDB API, and it has nothing to do with the the fact the you use the GetItem method.
Second, your body mapping template uses KeyconditionExpression that is used in DynamoDB Query API, but not in the GetItem. GetItem needs a Key specified, like here: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html#API_GetItem_Examples
Hope this helps.

In Jmeter, What would be syntax of parameters in Body Data section of HTTP Request Sampler, if I am using Rest APIs and taking input from CSV files?

I am trying to create 10 users at the same time in Jmeter, using REST APIs.
Test Data i.e. input is taken from CSV files (The details of users like user name, last name , mobile)
For this I have added one thread group,User Defined Variable,HTTP Header Manager, HTTP Request Sampler (which perform successful login into web application), JSON PATH EXTRACTOR ( to extract auth token, which will be used while adding user)
To Add User, I have used one "Loop Controller" - "HTTP Request Sampler" - HTTP Header Manager, CSV Data Set Config.
And to track result, View Results Tree and Aggregate Report.
Please tell me what would be the syntax of parameters which I am passing in "Body Data" section of HTTP Request sampler, so that it can read values from csv files.
Below is the syntax I am using now to add single user.
{
"phoneNo": "9998885551",
"lastName": "john25",
"email": "azp25#gmail.com",
"firstName": "ricky25",
"mobileNo": "9820420420"
}
If your CSV file looks like:
9998885551,john25,azp25#gmail.com,ricky25,9820420420
9998885552,john26,azp26#gmail.com,ricky26,9820420421
....
Configuration should be the following:
Filename: full path to your source .csv file
Variable Names: phone,lastname,email,firstname,mobile
Delimiter: ,
Populate other values according to your test scenario i.e. whether you want test to stop on .csv file end or re-spin or whatever.
And your HTTP Request should look like:
The main point is that variables defined in the CSV Data Set Config need to match the ones in the HTTP Request.
See Using CSV DATA SET CONFIG guide for detailed instructions.
I would also recommend adding the following entry to your HTTP Header Manager:
Name: Content-Type
Value: application/json
elsewise your request will be treated like plain text and may fail.
Also don't forget to disable View Results Tree listener for actual load test run as it consumes a lot of resources and may lead to out-of-memory errors on JMeter side.
Also,if your formparam\ Body data contains multiple parameters like this:
UserName=abc
password=abc123,
Instead of created two columns for userName and password, it can be given in single column like this:
UserName=abc&password=abc123
This way you can loop through multiple\different URL's which takes different numbers of bodydata
E.g.: If URL1 takes only username as body data and URL2 takes Username & password as body data the above will be an easy solution.