In IBM cloud some of the documentation refer to resource_ID for example in
the command "ibmcloud resource reclamation-restore resource_ID".
When I look at the info of my resource, I find a CRN and a GUID. Which one is is it? Or is there something else. It is my impression that it is different to service-instance which is used in other parts of the documentation
Usually, the resource ID is the GUID (globally unique identifier). The cloud resource name (CRN) is used to name a resource in unique way and often includes the GUID, the service type (Watson Assistant, Db2, Cloudant or something like this), the region and other information.
It could be that in some (JSON) objects, the crn is sometimes denoted as ID. But the actual resource ID is the GUID.
For resource reclamation the CLI documentation mentions the GUID as resource ID.
As indicated by data_henrik, the resource ID is the guid from the resource's CRN. If you use the command, ibmcloud resource reclamations, it will show you the guid in a column of the output
Related
I am currently working at an Powershell script that will automatically download the billing data from my companies CSP platform. I use following powershell module (https://github.com/Microsoft/Partner-Center-PowerShell)
And use the following api(that the module calls I guess) To get the overall price from the last month of all my subscriptions. https://learn.microsoft.com/en-us/partner-center/develop/get-a-subscriptions-resource-usage-information. With the Powershell module that is wonderfull I've managed to recieve good data from my Azure Resources and print them out in a CSV file for Power BI to create a report of them.
My question now is when I use power BI to create graphs of my cost and usage. I don't see the name of my resources (vm, storage, sql) instead I see names of the types (Read Operations,LRS Write Additional IO, ...) And of course that's also a good indicator. I would love to see the VM (the name of the vm or storage or sql) with the highest cost and usage not which type. The ResourceName in the response of the api is not exactly right. The Resource name ( in Resource URL formatting) however is available with this api: https://learn.microsoft.com/en-us/partner-center/develop/get-a-customer-s-utilization-record-for-azure.
But here I cannot retrieve the cost of my Azure Resource. I tried to combine the 2 api's (one to retrieve the cost and the other one to retrieve the Resource URL with the Resource ID as a combiner) but strangly enough some customers have data in the usage api and not in the utilization api. So that didn't helped out well. My question today is: Is it possible to retrieve the resource name or URL with the response data i got from this api: https://learn.microsoft.com/en-us/partner-center/develop/get-a-subscriptions-resource-usage-information . Or is there another way of providing the name of the object instead of the service.
The resource usage feature will not return the resource name. So, you will need to combine data from Get-PartnerCustomerSubscriptionUtilization and Get-PartnerAzureRateCard to get the resource name and the partner cost associated with each billable meter. Since you are working with Power BI, it might be a good idea to check out Partner-Center-Query. It is another project that allows you query data from the Partner Center API through Power Query.
What would be a rest API convention to get a resource based on a different identificator?
For example
GET
/resource/{id}
GET
/resource/{guid}
Since this could be considered as a dupliate resource and setting routes for this could be a problem, what is an alternative then would follow rest API guidelines?
Maybe
/resources/?guid={guid}
or
/resources/guid/{guid}
or something else?
Short answer
You could use both /resource/{id} and /resource/{guid}. Many frameworks support regular expressions for matching path parameter values.
Long answer
REST is an architectural style and not a cookbook for designing URIs (see notes below). It doesn't enforce any URI design and it's totally up to you to pick the URIs that better identify your resources.
What you should keep in mind is: it's perfectly fine to have multiple mappings for the same entity. And each mapping is a resource, according to Fielding's dissertation:
A resource is a conceptual mapping to a set of entities, not the entity that corresponds to the mapping at any particular point in time.
With that being said, if you are supporting DELETE, it's important to mention how it's supposed to work:
4.3.5. DELETE
The DELETE method requests that the origin server remove the association between the target resource and its current functionality. In effect, this method is similar to the rm command in UNIX: it expresses a deletion operation on the URI mapping of the origin server rather than an expectation that the previously associated information be deleted. [...]
Note 1: The URI syntax is defined in the RFC 3986. As general rule, the path is organized in hierarchical form (with segments separated by /) and can contain non-hierarchical data in the query component (starting with ?).
Note 2: The REST architectural style is described in the chapter 5 of Roy T. Fielding's dissertation and it defines a set of constraints that must be followed by the applications that follow such architecture. However it says nothing about what the URIs must be like.
Note 3: The examples of a popular article written by Martin Fowler explaining a model defined by Leonard Richardson suggest a URI structure that looks friendly and easy to read.
I wouldn't normally duplicate an endpoint. The question would be:
why does one client have an id while another has a guid?
what design choice allowed that to happen?
I would leave it as a single resource endpoint:
GET
/resource/{id}
so clients who access resources via their id will use the above endpoint. I'd allow clients who access resources via their guid to exchange what they have (guid) for what they need (id):
GET
/id/{guid}
The above returns a resource id for the given resource guid. The client can then call the main resource endpoint with the id they have just received:
GET
/resource/{id}
but ultimately I'd look into why some clients use a guid rather than an id and change that so all clients access the API in the same way.
I have a resource Task that is exposed via /task
I also have a resource TaskExecutions which is exposed by /taskexecutions
Both resources are entities in my model and I must list the Tasks but recover a field from the TaskExecution via join on a specific field to get the max execution time from the task
My question is:
What is the best design for a rest API in this case?
Should I just add the field on the response or create another resource url that exposes this "composed" resource?
I'm a fairly experienced SharePoint developer, but brand new to MS Project and Project Server / PWA.
In MS Project Pro, there is a column called "Unique ID" that seems to function like SharePoint's built-in list item "ID" field - an auto-incrementing integer (1 based).
How can I find a task's "Unique ID" from a project that has been saved and published to a Project Web App through Project Server's REST API?
The only "ID" on a Task object retrieved through
https://servername/pwa/_api/projectserver/projects('project-id')/tasks('task-id')
is a GUID, there doesn't seem to be any property associated with an integer ID.
I found this other question and answer over on the MSDN help site. It is about Project Server 2010, and about how to show the "Unique ID" field in a report. But the answer says (emphasis mine):
There are three ID fields in the MSP_EpmTask_UserView; TaskUID,
TaskIndex and TaskClientUniqueId. TaskUID is a GUID, TaskIndex
corresponds to the Task positional ID and TaskClientUniqueId
corresponds to the Unique Id field in Project Professional.
So it appears that this information is stored somewhere within Project Server, but... how do I get it through REST?
{PWA Site URL}/_api/ProjectData/Projects(guid'{project guid}')/Tasks()?$Select=TaskName,TaskId,TaskIndex,TaskClientUniqueId
Well, although the other answer here is correct, some explanation might be in order.
Project Server has two different REST endpoints, and they do not return the same data.
There is
<PWA site URL>/_api/ProjectServer/
and
<PWA site URL>/_api/ProjectData/
There is quite a bit of overlap in the data they return, but there are some fields that can only be retrieved through the ProjectServer endpoint, and there are some fields that can only be retrieved through the ProjectData endpoint.
As it turns out, TaskClientUniqueId can only be retrieved from the /_api/ProjectData/ endpoint.
Is there a way to request the cluster id from a cluster name?
Context:
In our context the default cluster allow child cluster to see, but not update, the data. I would like to notify the user that it is looking at data provided from a different cluster than its own.
Example
Cluster Product
#15:0 // cluster name : product. Product provided from head office
#115:0 //cluster name : productmybranch. Product provided from the branch
The branch sees the product from the head office, but should not update it. The oRoles fixes that.
How can I know that a branch user is currently looking at a product from the head office?
I was looking for a request like (That query does not work)
select metatdata:cluster from cluster:productmybranch
Or any way via the JAVA API
(running on orientdb 2.1.0)
this might help you at least with knowing, it isn't directly possible.
Can I access Cluster/s name for objects during a query on OrientDB?
Scott
I have done it through the Java API. The call to getClusterIdByName just looks up the class/table name in a ConcurrentHashMap that the OrientDB Java API uses.
OObjectDatabaseTx objectDB = OObjectDatabasePool.global().setup(1, 4).acquire(dbName, dbUser, dbPassword);
int clusterId = objectDB.getClusterIdByName("ClassName");
objectDB.close();