How to get the status of a travis-ci request - travis-ci

I want to trigger a travis run on the master branch of a repository. That works alright following the instructions in the travis docs, but then I don't know how to get the status of the execution. The request returns some IDs, but none seem to be the request id.
$ body='{
"request": {
"branch":"master"
}}'
$ curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $TOKEN" -d "$body" https://api.travis-ci.org/repo/snapcore%2Fsnapcraft/requests
{
"#type": "pending",
"remaining_requests": 9,
"repository": {
"#type": "repository",
"#href": "/repo/6402925",
"#representation": "minimal",
"id": 6402925,
"name": "snapcraft",
"slug": "snapcore/snapcraft"
},
"request": {
"repository": {
"id": 45199136,
"owner_name": "snapcore",
"name": "snapcraft"
},
"user": {
"id": 38186
},
"message": null,
"branch": "master",
"config": {
}
},
"resource_type": "request"
}
I can get all the requests using this endpoint: https://docs.travis-ci.com/api?http#requests
But then I would have to find my request, and again I'm not sure how to identify it.

The response should include a request.id as well:
{
"#type": "pending",
"remaining_requests": 49,
"repository": {
"#type": "repository",
"#href": "/repo/7181875",
"#representation": "minimal",
"id": 7181875,
"name": "repo_name",
"slug": "repo_user/repo_name"
},
"request": {
"repository": {
"id": 160982756,
"owner_name": "repo_owner",
"name": "repo_name"
},
"user": {
"id": 919859
},
"id": 160105240, # <-- this is the request ID that can be used in /request/#id
"message": null,
"branch": "master",
"config": {
}
},
"resource_type": "request"
}
This seems to be missing from what you posted. Either this was added in the meantime, or it got lost for you somehow.

Related

YouTubeData API v3: transition of 'ready' to 'live' broadcast fails with an active stream "403 Invalid Transition"

I tried to add an already active stream to a new broadcast, and can't get the broadcast started. The steps I took were.
Created a new Broadcast.
curl --request POST \
"https://youtube.googleapis.com/youtube/v3/liveBroadcasts?part=snippet,contentDetails,status" \
--header "Authorization: Bearer XXX" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data "{'snippet':{'scheduledStartTime':'2021-05-18T17:28:00Z','title':'Tester','description':'descr'},'status':{'privacyStatus':'public','selfDeclaredMadeForKids':false},'contentDetails':{'enableAutoStart':true,'recordFromStart':true,'latencyPreference':'normal','enableAutoStop':false}}"
{
"kind": "youtube#liveBroadcast",
"etag": "gyv8ux9AiVL_NuZefS8SGXc3iZQ",
"id": "z--Lm8b1mU0",
"snippet": {
"publishedAt": "2021-05-18T17:27:39Z",
"channelId": "XXXXXXXXXXXXXXXX",
"title": "Tester",
"description": "descr",
...
},
"scheduledStartTime": "2021-05-18T17:28:00Z",
"isDefaultBroadcast": false,
"liveChatId": "KicKGFVDRUZXb015R0VtWFdrcDdkV1BMWWRXQRILei0tTG04YjFtVTA"
},
"status": {
"lifeCycleStatus": "created",
"privacyStatus": "public",
"recordingStatus": "notRecording",
"madeForKids": false,
"selfDeclaredMadeForKids": false
},
"contentDetails": {
"monitorStream": {
"enableMonitorStream": true,
"broadcastStreamDelayMs": 0,
...
},
"enableEmbed": false,
"enableDvr": true,
"enableContentEncryption": false,
"startWithSlate": false,
"recordFromStart": true,
"enableClosedCaptions": false,
"closedCaptionsType": "closedCaptionsDisabled",
"enableLowLatency": false,
"latencyPreference": "normal",
"projection": "rectangular",
"enableAutoStart": true,
"enableAutoStop": false
}
}
Bind the already active stream to the Broadcast. I expected the enableAutoStart in the created broadcast to auto start the broadcast, though it did not.
curl --request POST "https://youtube.googleapis.com/youtube/v3/liveBroadcasts/bind?id=z--Lm8b1mU0&part=snippet,contentDetails,status&streamId=EFWoMyGEmXWkp7dWPLYdWA1615776388366728" --header "Authorization: Bearer XXXXXXXX" --header "Accept: application/json"
{
"kind": "youtube#liveBroadcast",
"etag": "L_Q87yK0gMxEM7VZ-aKHCTZ7n8g",
"id": "z--Lm8b1mU0",
"snippet": {
"publishedAt": "2021-05-18T17:27:39Z",
"channelId": "UCEFWoMyGEmXWkp7dWPLYdWA",
"title": "Tester",
"description": "descr",
},
"scheduledStartTime": "2021-05-18T17:28:00Z",
"isDefaultBroadcast": false,
"liveChatId": "KicKGFVDRUZXb015R0VtWFdrcDdkV1BMWWRXQRILei0tTG04YjFtVTA"
},
"status": {
"lifeCycleStatus": "ready",
"privacyStatus": "public",
"recordingStatus": "notRecording",
"madeForKids": false,
"selfDeclaredMadeForKids": false
},
"contentDetails": {
"boundStreamId": "EFWoMyGEmXWkp7dWPLYdWA1615776388366728",
"boundStreamLastUpdateTimeMs": "2021-05-18T16:58:04Z",
"monitorStream": {
"enableMonitorStream": true,
"broadcastStreamDelayMs": 0,
...
},
"enableEmbed": false,
"enableDvr": true,
"enableContentEncryption": false,
"startWithSlate": false,
"recordFromStart": true,
"enableClosedCaptions": false,
"closedCaptionsType": "closedCaptionsDisabled",
"enableLowLatency": false,
"latencyPreference": "normal",
"projection": "rectangular",
"enableAutoStart": true,
"enableAutoStop": false
}
}
Attempted to transition the broadcast to live. I also tried transition to testing, which failed with the same error.
curl --request POST -H "Authorization: Bearer XXXXXX" "https://www.googleapis.com/youtube/v3/liveBroadcasts/transition?part=id,snippet,contentDetails,status&broadcastStatus=live&id=z--Lm8b1mU0"
{
"error": {
"code": 403,
"message": "Invalid transition",
"errors": [
{
"message": "Invalid transition",
"domain": "youtube.liveBroadcast",
"reason": "invalidTransition",
"extendedHelp": "https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/transition#params"
}
]
}
}
Verified the stream is still active.
curl "https://youtube.googleapis.com/youtube/v3/liveStreams?part=snippet,cdn,contentDetails,status&id=EFWoMyGEmXWkp7dWPLYdWA1615776388366728" -H "Authorization: Bearer XXXXXXXXXXX" -H "Accept: application/json"
{
"kind": "youtube#liveStreamListResponse",
"etag": "ejyo1UhcC8AFCfiY-TxKo4yhwv0",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#liveStream",
"etag": "IZNA8olA5tx8tu2fGKPg4ws0YpM",
"id": "EFWoMyGEmXWkp7dWPLYdWA1615776388366728",
"snippet": {
"publishedAt": "2021-03-15T02:46:29Z",
"channelId": "XXXXXXXXXXXXXXXXXXXXXXXX",
"title": "Default stream key",
"description": "Description for default stream key",
"isDefaultStream": false
},
"cdn": {
"ingestionType": "rtmp",
"ingestionInfo": {
"streamName": "XXXX-XXXX-XXXX-XXXX-XXXX",
"ingestionAddress": "rtmp://a.rtmp.youtube.com/live2",
"backupIngestionAddress": "rtmp://b.rtmp.youtube.com/live2?backup=1",
"rtmpsIngestionAddress": "rtmps://a.rtmps.youtube.com/live2",
"rtmpsBackupIngestionAddress": "rtmps://b.rtmps.youtube.com/live2?backup=1"
},
"resolution": "variable",
"frameRate": "variable"
},
"status": {
"streamStatus": "active",
"healthStatus": {
"status": "good"
}
},
"contentDetails": {
...
"isReusable": true
}
}
]
}
Thoughts on how to make this work?
I figured it out.
Apparently you cannot have a brodcast created with enableAutoStart=true and then add an active stream. It seems that enableAutoStart=true fails the broadcast transition API calls to change the status to testing or live or complete.
To get this to work, I stopped then started sending to the stream, which caused the stream to transition to inactive then back to active. The transition caused the broadcast to start.
Alternatively, to get this to work without the restart of the stream, I did the following:
create the broadcast with enableAutoStart=false
bind the active stream to the broadcast (as in the question).
transition the broadcast to testing, then to live.
This seems to work fine.
Would have been nice to have the error message for transitioning indicate it was the enableAutoStart which was the problem.

Create issue with custom field by JIRA API

I want to create an issue using Jira REST API. Below code will works to create simple issue:
curl --request POST \
--url 'https://company_name.atlassian.net/rest/api/3/issue' \
--user 'user:token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data {
"fields": {
"summary": "Remote test with request type",
"issuetype": {
"id": "12542"
},
"project": {
"key": "Test"
},
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Second remote test",
"type": "text"
}
]
}
]
}
}
}
The thing is I want to create an issue with custom field - customfield_10029. By default it's set as nil but when I changed it manually in my board I saw something few more things inside of it:
"customfield_10029":
{"_links": {"jiraRest": "https://company_name.atlassian.net/rest/api/2/issue/241495", "web": "https://company_name.atlassian.net/servicedesk/customer/portal/19/SUP-11", "self": "https://company_name.atlassian.net/rest/servicedeskapi/request/241495"},
"requestType":
{"_expands": ["field"],
"id": "358",
"_links": {"self": "https://company_name.atlassian.net/rest/servicedeskapi/servicedesk/19/requesttype/358"},
"name": "Add Colaborator / Team Member",
"description": "e.g. external dev",
"helpText": "you can find github nicks down here https://github.com/some_url",
"issueTypeId": "12542",
"serviceDeskId": "19",
"groupIds": ["70"],
"icon":
{"id": "19558",
"_links":
{"iconUrls":
{"48x48": "https://company_name.atlassian.net/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=19558&size=large",
"24x24": "https://company_name.atlassian.net/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=19558&size=small",
"16x16": "https://company_name.atlassian.net/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=19558&size=xsmall",
"32x32": "https://company_name.atlassian.net/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=19558&size=medium"}}}}
So I thought the only thing I need to do is to add above code to the first POST request, like below:
curl --request POST \
--url 'https://company_name.atlassian.net/rest/api/3/issue' \
--user 'user:token' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data {
"fields": {
"summary": "Remote test with request type",
"issuetype": {
"id": "12542"
},
"project": {
"key": "SUP"
},
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Second remote test",
"type": "text"
}
]
}
]
},
"customfield_10029":
{"_links": {"jiraRest": "https://company_name.atlassian.net/rest/api/2/issue/241495", "web": "https://company_name.atlassian.net/servicedesk/customer/portal/19/SUP-11", "self": "https://company_name.atlassian.net/rest/servicedeskapi/request/241495"},
"requestType":
{"_expands": ["field"],
"id": "358",
"_links": {"self": "https://company_name.atlassian.net/rest/servicedeskapi/servicedesk/19/requesttype/358"},
"name": "Add Colaborator / Team Member",
"description": "e.g. external dev",
"helpText": "you can find github nicks down here https://github.com/some_url",
"issueTypeId": "12542",
"serviceDeskId": "19",
"groupIds": ["70"],
"icon":
{"id": "19558",
"_links":
{"iconUrls":
{"48x48": "https://company_name.atlassian.net/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=19558&size=large",
"24x24": "https://company_name.atlassian.net/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=19558&size=small",
"16x16": "https://company_name.atlassian.net/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=19558&size=xsmall",
"32x32": "https://company_name.atlassian.net/secure/viewavatar?avatarType=SD_REQTYPE&avatarId=19558&size=medium"}}}}
}
}
But I'm getting an error:
{"errorMessages":["Unexpected end-of-input: expected close marker for OBJECT (from [Source: org.apache.catalina.connector.CoyoteInputStream#2e2743e7; line: 1, column: 0])\n at [Source: org.apache.catalina.connector.CoyoteInputStream#2e2743e7; line: 46, column: 1863]"]}
Is there any logic behind that? how to create such an issue with customfield?
Looks like you're missing a brace.
--data { #<- This brace has no closing brace
"fields": { #<- This brace closes with the very last brace

AeroGear: How to send silent push notification with AeroGear to iOS using AeroGear UnifiedPush Server?

I created silent push notifications with Pusher that works with that JSON:
{
"aps" : {
"content-available" : 1
},
"acme1" : "bar",
"acme2" : 42
}
What is important here is the content-available to 1 to get it.
My problem now, is to use it in AeroGear UnifiedPush Server & Docker, but when I construct my JSON, I cannot put that keys.
I tried this without success:
curl -u "c94ab6da-17e1-4c35-b17f-1ab482152a65:57781ef0-9105-440d-b902-217461c0e743" -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{
"message": {
"alert": "Hello from the curl HTTP Sender!","content-available": true
}}' http://localhost:18081/rest/sender
It returns me an error:
Unrecognized field "content-available" (class org.jboss.aerogear.unifiedpush.message.Message), not marked as ignorable
Documentation
How to send Push Notifications in iOS with AeroGear UnifiedPush Server?
You should add apns object to your JSON. A complete message sample is as follow :
{
"message": {
"alert": "HELLO!",
"sound": "default",
"badge": 2,
"consolidationKey": null,
"priority": "normal",
"windows": {
"type": "tile",
"duration": null,
"badge": null,
"tileType": "TileWideBlockAndText01",
"toastType": null,
"images": [
],
"textFields": [
],
"page": "/MainPage.xaml"
},
"apns": {
"title": null,
"action": null,
"action-category": "some value",
"url-args": null,
"content-available": true,
"mutable-content": false,
"localized-key": null,
"localized-arguments": null,
"localized-title-key": null,
"localized-title-arguments": null
},
"user-data": {
"key2": "other value",
"key": "value"
},
"simple-push": "version=123"
},
"criteria": {
"categories": [
"someCategories"
],
"variants": [
"someVariantIDs"
],
"alias": [
"someUsername"
],
"deviceType": [
"someDevice"
]
},
"config": {
"ttl": 3360
}
}
You can test it with your curl command.

apiconnect: Create API for geoJSON data

Can someone explain how to create an API with APIC toolkit?
I would like to use this API to work with a Cloudant DB on IBM Bluemix or a local CouchDB to create, read and update of the geoJSON data.
Below is an easy example of typical data to store name and coordinates of point of interests.
[{
"type": "Feature",
"properties": {
"name": "Nice Place 1"
},
"geometry": {
"type": "Point",
"coordinates": [16.45961, 48.23896]
}
}, {
"type": "Feature",
"properties": {
"name": "Nice Place 2"
},
"geometry": {
"type": "Point",
"coordinates": [16.34561, 49.89612]
}
}]
LoopBack supports GeoPoint (i.e. Point in GeoJSON) datatype.
Considering your typical example, let's say you have a model named: Feature, then to use GeoPoint, your Feature.json should look like:
{
"name": "Feature",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"name": {
"type": "string"
},
"geometry": {
"type": "geopoint"
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}
Now, this Feature model, having PersistedModel as base, will have common CRUD methods exposed as REST endpoints and you can store data, for example, using CURL:
curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" -d "{
\"name\": \"Nice Place 1\",
\"geometry\": {
\"lat\": 16.20,
\"lng\": 48.23
}
}" "http://0.0.0.0:3000/api/Features"
Hope that helps with creating an API that supports GeoPoint.
Re: Cloudant db, I am not sure if it supports geo-spatial data out of the box, however there seems support for it: https://cloudant.com/product/cloudant-features/geospatial/
I tried with the model above with a loopback app(using cloudant as ds) and it's explorer:
Create with sample data:
{
"name": "string",
"geometry": {
"lat": 12,
"lng": 13
}
}
And get it from GET/ myGeoModels successfully:
[
{
"name": "string",
"geometry": {
"lat": 12,
"lng": 13
},
"id": "f08301abe833ad427c9c61ffd30df8ef"
}
]
APIC should have same behaviour of loopback.

Webhook input not available in scripting step?

I have an internal app that uses a webhook listener and some scripting to manipulate the input data. I'm posting this to it:
curl -X POST -d '{
"assignment_id": 12345,
"updated_custom_fields": [{
"name": "RNVIDAYEBB",
"value": "updated!"
},
{
"name": "QUFTXSIBYA",
"value": "and me too"
}
],
"custom_fields": [{
"id": 981,
"name": "RDEXDPVKRD",
"fields": [
{
"id": 4096,
"name": "RNVIDAYEBB",
"default": "EDJEAJICYW",
"required": true,
"value": "Blah"
},
{
"id": 4097,
"name": "QUFTXSIBYA",
"default": "",
"required": true,
"value": ""
}]
}]
}' "https://hooks.zapier.com/hooks/catch/......"
My script is as follows:
update_custom_fields_by_name_pre_write: function(bundle) {
var updatedFields = _.map(bundle.request.data.custom_fields, function(group) {
return _.map(group.fields, function(field) {
return _.extend(field, _.findWhere(bundle.request.data.updated_custom_fields, { name: field.name} ));
});
});
bundle.request.data = updatedFields;
return bundle.request;
}
I know that the merging logic is good, but it appears that the custom_fields and updated_custom_fields arrays are not present in the bundle.request.data object. Anyone know how to get access to them in the script?
It seems like you should be using update_custom_fields_by_name_catch_hook to capture the incoming static webhook data (instead of _pre_write). If you use that, you can capture the data within bundle.cleaned_request.custom_fields and bundle.cleaned_request.updated_custom_fields.

Resources