Eloqua - Extract LastModifiedBy details of Security Group using REST API - rest

I am trying to retrive security group details (last modified by field) using REST API,but unable to extract this information.
Here is my GET -
GET /Api/rest/2.0/system/security/groups?depth=partial&search=acronym%3DRXCM&xsrfToken=dfa16605-d884-4ebc-9a7b-16fd36c9181a
Response
{
"elements":
[
{
"type":"SecurityGroup",
"id":"29",
"createdAt":"1427641487",
"createdBy":"13",
"depth":"partial",
"name":"Central Marketing User",
"updatedAt":"1427641487",
"acronym":"RXCM",
"isEffective":"false",
"isReadOnly":"false"
}
],
"page":1,
"pageSize":1000,
"total":1
}
Does anyone knows how to get LastModifiedBy field?

You'll get more data on the response if you use the depth=complete instead of partial.
I'm not sure if that will return the LastModifiedBy.

Related

How to pass owner attribute when creating user story using Rally API?

I am trying to pass the owner attribute to create a user story in rally using rally API But I am encountering below error.
{
"CreateResult": {
"_rallyAPIMajor": "2",
"_rallyAPIMinor": "0",
"Errors": [
"Cannot parse object reference from \"{\"Owner\": {\"_refObjectName\": \"Ron\"}}\""
],
"Warnings": [
"Ignored JSON element HierarchicalRequirement.PortfolioItem during the processing of this request."
]
}
}
My request payload
{
"HierarchicalRequirement":{
"Name": "hello Wrold",
"Description":" 123 test description",
"Workspace": "/workspace/18686460234",
"Project":"/project/1025697468602323",
"PortfolioItem":"",
"Owner":{"_refObjectName":"Ron"},
"ScheduleState":"Defined"
}
}
Any thoughts?
In general, when referring to an object property that itself is an object (as in this case with the User object), you pass in the actual value of _ref, not another object. If you have previously been passed the reference to the user as a full blown URI, then you can still pass that in and the SDK will convert it to a _ref.
If you go to the webservice docs (https://rally1.rallydev.com/slm/doc/webservice/) for your subscription and go down to the User section, you can get the docs to fetch you some examples of users. The _ref will come back something like:
https://rally1.rallydev.com/slm/webservice/v2.0/user/39776836851
I believe that you can either use that, or just truncate it to the number at the end. So the code will need to be changed so that the Owner line reads:
"Owner" : "https://rally1.rallydev.com/slm/webservice/v2.0/user/39776836851"

API method to escalate ticket to SoftLayer

Using BAP creds I am able to pull all my accounts tickets, check content and update. Which API call to use to escalate ticket to SoftLayer?
this is the API service that BAP uses to perform its actions:
http://sldn.softlayer.com/reference/services/SoftLayer_Brand
as you can see there is a method to list the tickets, however there is no a method to create tickets, that is because when you create a ticket using BAP is the same thing like if you would create the ticket using control portal the method used is this:
http://sldn.softlayer.com/reference/services/SoftLayer_Ticket/createStandardTicket
here an example to create tickets using the Softlayer's Python client:
https://softlayer.github.io/python/create_ticket/
using REST:
POST https://$USERNAME:$APIKEY#api.softlayer.com/rest/v3/SoftLayer_Ticket/createStandardTicket
payload:
{
"parameters":[{
"subjectId": 1121,
"assignedUserId": 11111
},"this is my test ticket"]
}
Note: replace assignedUserId with a valid user id
Regards
To escalate a ticket to SoftLayer, you need to follow these steps:
1. Add an update to the ticket
https://$user:$apiKey#api.softlayer.com/rest/v3/SoftLayer_Ticket/21588750/addUpdate
Method: Post
{
"parameters":[
{
"entry":"Escalate to SoftLayer",
"type":
{
"keyName":"AGENT"
}
}
]
}
2. Edit the ticket with the following information:
https://$user:$apiKey#api.softlayer.com/rest/v3/SoftLayer_Ticket/21588750/edit
Method: Post
{
"parameters":[
{
"groupId":1008, "changeOwnerFlag":true
}
]
}
Note: “groupId : 1008” refers to Support group. To get available group identifiers (groupId), try the following rest request:
https://$user:$apiKey#api.softlayer.com/rest/v3/SoftLayer_Ticket/getAllTicketGroups
Method: Get
References:
SoftLayer_Ticket::addUpdate
SoftLayer_Ticket::edit
SoftLayer_Ticket::getAllTicketGroups

Passing discount code in Orders API on Shopify

I have been trying to develop an app that takes an order on Shopify on a different channel. I successfully placed an order through the API but I am not able to include the discount code along with the order. The JSON object for the POST data is as below:
{
order: {
email : request.params.order.email, // string
financial_status : 'pending', // string
send_receipt : true, // boolean
send_fulfillment_receipt : false, // boolean
note : request.params.order.note, // string
discount_codes : [], // supposed to be an array of Object| Problem here,
line_items : request.params.order.line_items, // array
customer : request.params.customer, // JSON object
billing_address : request.params.order.billing_address, // JSON object
shipping_address : request.params.order.shipping_address // JSON object
}
}
According to the documentation, the discount_codes is like this -
Applicable discount codes that can be applied to the order. If no codes exist the value will default to blank. A Discount code will include the following fields:
amount: The amount of the discount.
code: The discount code.
type: The type of discount. Can be one of : "percentage", "shipping", "fixed_amount" (default).
What am I doing wrong? My discount_codes is this
[{amount: 100,code:'WELCOME10',type:'percentage'}]
Has anyone done this before?
According to this response from Shopify what you are trying to do is only possible if you pass the total_discounts field along as well with the total amount of the discount you want to apply.
As you will see in this other answer, any codes you have created through Shopify are not available to use with the API and their usage will not be recorded.
I was trying to use this API in order to test the application of different coupon codes that I was generating, but this does not seem to be possible. Apparently, the API was intended for applying discounts that are custom, not ones that already exist in Shopify. This is a frustrating limitation to me.
I successfully create orders with discounts all the time, without ShopifyPlus as that is irrelevant. The data structure that works for me looks like this:
[ { "code": "Shop By PizzleFuzzle 10%", amount: "10", "type": "percentage" } ]
The discount object is available only for Shopify Plus merchants.
Once you are a Shopify Plus merchant, you will be able to create discount codes like that:
POST /admin/discounts.json
{
"discount": {
"discount_type": "percentage",
"value": "15.0",
"code": "balderdash"
}
}
Please see more detailed documentation in the discount object at Shopify API: https://help.shopify.com/api/reference/discount
You should use the value property name instead of amount property name.
e.g.
{value: 100,code:'WELCOME10',type:'percentage'}
and not
{amount: 100,code:'WELCOME10',type:'percentage'}

How to delete that are not attached to VM through Rest Calls

I am new to BPM , softlayer and REST. I completed creating storages (performance and endurance). Now I need to know How will I be able to delete the storages that are not attached to any Virtual Machines. I did not find any thing related to this. Please make a needful favour. Thanks in advance.
Please try the following request:
https://[username]:[apikey]#api.softlayer.com/rest/v3/SoftLayer_Billing_Item_Cancellation_Request/createObject
Method: POST
Json Payload:
{
"parameters": [
{
"accountId": 202019,
"items": [
{
"billingItemId": 65959265,
"immediateCancellationFlag": true
}
]
}
]
}
How to get the billingItemId information and account id?
Execute:
https://[username]:[apikey]#api.softlayer.com/rest/v3/SoftLayer_Network_Storage/4494893/getObject?objectMask=mask[accountId,username,billingItem.id]
Method: GET
If you don’t know the Network Storage id, please execute this request using the username:
https://[username]:[apikey]#api.softlayer.com/rest/v3/SoftLayer_Account/getNetworkStorage?objectFilter={"networkStorage": {"username": {"operation": "storageName"}}}&objectMask=mask[billingItem]
Method: GET
References:
SoftLayer_Billing_Item_Cancellation_Request::createObject
SoftLayer_Network_Storage::getObject

Rest API get resource id by field

What is a correct rest way of getting a resource ID by a field, for example a name. Take a look at the following operations:
GET /users/mike-thomas
GET /users/rick-astley
I don't want to use these operations at my API end, instead I want to write an API operation that will get me the ID when submitting a field (name in the case of users) for example:
GET /users/id-by-field
Submitted data:
{
"fullName": "Mike Thomas"
}
Return data:
{
"data": {
"id": "123456789012345678901234"
}
}
What you want is known as an algorithmic URL where the parameters for the algorithm are passed as URL parameters:
GET /users?name="Mike Thomas"
Advantages are that you are using the "root" resource (users) and the search parameters are easily extended without having to change anything in the routing. For example:
GET /users?text="Mike"&year=1962&gender=M
where text would be searched for in more than just the name.
The resultant data would be a list of users and could return more than the identification of those users. Unless fullName uniquely identifies users, that is what you need to allow for anyway. And of course the list could contain a single user if the parameters uniquely identified that user.
{
users: [
{
id: "123456789012345678901234",
fullName: "Mike Thomas",
dateJoined: 19620228
}
, {
id: "234567890123456789012345"
fullName: "Rick Astley",
dateJoined: 19620227
}
]
}