I am trying to generate an access code using the script
https://raw.githubusercontent.com/fgalan/oauth2-example-orion-client/master/token_script.sh
I believe the response json has changed and the sed pattern is not working anymore.
How can I generate a valid access token?
Json response:
{
"access": {
"token": {
"issued_at": "2015-05-12T14:29:03.523315",
"expires": "2015-05-12T15:29:03Z",
"id": "?????",
"audit_ids": [
"????"
]
},
"serviceCatalog": [],
"user": {
"username": "pedro#viur.pt",
"roles_links": [],
"id": "pedro-almeida",
"roles": [],
"name": "pedro#viur.pt"
},
"metadata": {
"is_admin": 0,
"roles": []
}
}
}
line that generates the token
TOKEN=`echo $RESP | sed "s/{\"access\":{\"token\":{.*\"id\":\"\(.*\)\"},\"user.*$/\1/g"`
I have tried to use the access:token:id returned but it does not work.
The new id is also shorter then the old ones
Thanks
This problem was caused by the IdM migration at FIWARE Lab in early May 2015. After be aware of it, the PEP at orion.lag.fiware.org and token generation script have been fixed.
Please, donwload again the token_script.sh file and try again. It should work.
Related
I am using the following SDK to search for and purchase flights via Amadeus:
https://github.com/autotune/amadeus/pull/1/files
This was a previously abandoned project I have decided to take on and make work. As part of that project I am trying to purchase a ticket in the sandbox environment and getting the following error:
{
"errors": [
{
"code": 477,
"title": "INVALID FORMAT",
"detail": "carrier code is a 2 or 3 alphanum except YY and YYY",
"source": {
"pointer": "/data/flightOffers[0]/itineraries[1]/segments[0]/operating/carrierCode",
"example": "AF"
},
"status": 400
}
]
}
Here is the json data being sent:
{
"type": "flight-order",
"travelers": [
{
"id": "1",
"dateOfBirth": "1990-02-15",
"name": {
"firstName": "Foo",
"lastName": "Bar"
},
"gender": "MALE",
"contact": {
"emailAddress": "foo#bar.com",
"phones": [
{
"deviceType": "MOBILE",
"countryCallingCode": "33",
"number": "5555555555"
}
]
}
}
],
"ticketingAgreement": {
"option": "DELAY_TO_CANCEL",
"delay": "6D"
},
"remarks": {},
"operating": {
"carrierCode": "UA"
}
}
Any help appreciated!
The error suggests that the sent payload is invalid. I'd advice you use a tool like Curl or Postman to verify you're using the right API documentation, before debugging actual code.
After further reading your PR and checking the API reference at :
https://developers.amadeus.com/self-service/category/air/api-doc/flight-create-orders/api-reference
I think you need to confirm that the Carrier code being passed is available in the segments under:
flightOffers > itineraries > segments
Although the API reference doesn't have operating > carrierCode like you used in the data sent, my guess after seeing the API error response you shared is that they are performing a check against the flight offers passed.
I suggest you check the results gotten when you call the flightOffers and also add it to the payload sent to the sandbox.
I want to create new alerts(High CPU,RAM) for all AppServicePlans in a given subscription. I could not find Powershell commands to create new alerts. Is there a way we can create these alerts for all appserviceplans with a single script? May be using ARM template?
Sorry for pasting a direct answer, but I cannot yet comment. You get the error because in the documentation for Add-AzMetricAlertruleV2 it states: "$act is the output of New-AzActionGroup cmdlet". Meaning you need to use for example:
$act = New-AzActionGroup -ActionGroupId "testActionGroup"
After that you need to add it in the parameter -ActionGroup $act for it to work.
If you look at Resource Explorer and navigate to a manually created (near-realtime) alert, you should see the "critera" object defined like below. Here is a full example of a resource that seems to be working. Create some variables for each of your values:
{
"type": "Microsoft.Insights/metricAlerts",
"apiVersion": "2018-03-01",
"name": "[variables('alertName')]",
"location": "global",
"dependsOn": [],
"tags": {
"[concat('hidden-link:', variables('applicationInsightsResourceId'))]": "Resource",
"[concat('hidden-link:', variables('webtestResourceId'))]": "Resource"
},
"properties": {
"description": "[concat('Alert for ', parameters('availibilityTestName'))]",
"severity": 4,
"enabled": true,
"scopes": [
"[variables('webtestResourceId')]",
"[variables('applicationInsightsResourceId')]"
],
"evaluationFrequency": "PT5M",
"windowSize": "PT15M",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria",
"webTestId": "[variables('webtestResourceId')]",
"componentId": "[variables('applicationInsightsResourceId')]",
"failedLocationCount": 3
},
"actions": [
{
"actionGroupId": "[resourceId('microsoft.insights/actiongroups', 'webhook')]",
"webHookProperties": {
// Some properties to send to webhook
}
}
]
}
}
I am trying to move files on our internal TFS using Python and the TFS REST API; the server appears to only support the API up-to version 2, but on MSDN I cannot find any docs for versions below v4.1.
The URL I'm posting to is https://<server>/tfs/<Collection>/<Project>/_apis/tfvc/changesets
Currently my best guess at the correct JSON body for the post request looks like this:
{
"comment": "moved file",
"changes": [{
"changeType": "rename",
"item": {
"path": "<filepath>",
"version": 468,
"sourceServerItem": "<filepath>"
}
}]
}
But i cannot get further than an HTTp error 400 bad request with the following message
{
"$id": "1",
"innerException": null,
"message": "Exactly one value for PathActions is required.\r\nParameter name: change.SourceServerItem",
"typeName": "System.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"typeKey": "ArgumentException",
"errorCode": 0,
"eventId": 0
}
And for the life of me i cannot find any reference to PathActions on google, that is not for git instead of tfvc, or a correct way of providing a value for this item.
Does anybody have a way of renaming/moving files on a TFVC via a HTTP request?
It just occurred to me to do a rename using the TFS web interface and peek at the request sent by the browser.
Turns out this is the correct format:
{
"comment": "Moved File",
"changes": [
{
"changeType": 8,
"sourceServerItem": "<old path>",
"item": {
"path": "<new path>",
"version": 470
}
}
]
}
The following is a sample schema from the OneNote API documentation at this site and will can be used with json2csharp.com with no problems.
http://dev.onenote.com/docs#/reference/get-notebooks.
{
"createdBy": "user name",
"createdTime": "2013-10-05T10:57:00.683Z",
"id": "notebook ID",
"isDefault": false,
"isShared": false,
"lastModifiedBy": "user name",
"lastModifiedTime": "2014-01-28T18:49:00.47Z",
"links": {
"oneNoteClientUrl": {
"href": "onenote:https://{client URL}"
},
"oneNoteWebUrl": {
"href": "https://{web URL}"
}
},
"name": "notebook name",
"sectionGroupsUrl": "https://www.onenote.com/api/v1.0/notebooks/{notebook ID}/sectionGroups",
"sectionsUrl": "https://www.onenote.com/api/v1.0/notebooks/{notebook ID}/sections",
"self": "https://www.onenote.com/api/v1.0/notebooks/{notebook ID}",
"userRole": "Contributor"
}
However, using the following Get Notebooks link has a different schema that doe
sn't pass json2csharp. Parsing your JSON didn't work. Please make sure it's valid.
"https://graph.microsoft.com/v1.0/me/onenote/notebooks"
createdBy and lastmodifiedBy are thrown as exceptions.
The sample from the apigee.com/console app uses the https://www.onenote.com/api/v1.0/me/notes/notebooks link and has the correct schema.
How do I resolve this discrepancy? Or am I mistaken?
The response payload returned from the Microsoft Graph API is slightly different from the response payload returned from the OneNote API directly.
Here's a reference to the notebook properties returned from Microsoft Graph: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/notebook
And this is what gets returned from the OneNote API directly:
https://msdn.microsoft.com/en-us/library/office/dn769050.aspx => Response properties
via Jmeter I get the json response:
{
"status": 0,
"response": [ {
"id": "123456789",
"login": "xxxxxxxxxxxxx",
"email": "xxxxxxxxxxxxx#xxxxxxx.xxxxx",
"system": "portal",
"firstName": "ÃÂûõúÃÂõù",
"middleName": "ÃÂðÃÂøûÃÂõòøÃÂ",
"lastName": "ÃÂþÃÂõÃÂþò"
}]
}
How can I solve this problem of wrong encoding for this response? The text is russian.
Try with last nightly build (upcoming 2.10) it should be ok, if not report a bug.
2.10 should be released in few weeks from now.