I am using branch.io for my android app. I am trying to generate via POST method and this is the code:
{"branch_key":"key_test_lerbZ22zyjfpfFtl2auzukafywi220dN", "campaign":"new_product_annoucement", "channel":"email", "tags":["monday", "test123"],
"data":"{\"name\": \"Alex\", \"email\": \"alex#branch.io\", \"user_id\": \"12346\", \"$desktop_url\": \"https://file.town/download/odrqliwc94d440jt08wxngceo\",\"$marketing_title\": \"2\"}"}
In the dashboard, the campaign can be seen, the channel can be seen, and the generated URL goes to the desired site. But the generated URL does not show up in the Marketing tab in the dashboard to show the URL's statistics with regards to clicks, downloads and installs.
Is there any code I am missing in it?
To use the Branch HTTP API to create a link that shows up in the Marketing section of the Branch dashboard you need to add the parameter "type":2 at the root level of the request. You will also want to use a $marketing_title that is descriptive.
Here is an updated curl request using the parameters you provided:
curl -X POST -H "Content-Type: application/json" -d '{"type":2, "branch_key":"key_test_lerbZ22zyjfpfFtl2auzukafywi220dN", "campaign":"new_product_annoucement", "channel":"email", "tags":["monday", "test123"], "data":"{\"name\": \"Alex\", \"email\": \"alex#branch.io\", \"user_id\": \"12346\", \"$desktop_url\": \"https://file.town/download/odrqliwc94d440jt08wxngceo\",\"$marketing_title\": \"Super Amazing Branch Link\"}"}' https://api.branch.io/v1/url
Related
I'm trying to test my apps script doPost function, with postman. so far I have:
function doPost(e) {
var id = '1L_U7MhmV............................'
SpreadsheetApp.openById(id).getSheetByName('responses').appendRow([new Date()]);
var params = JSON.stringify(e.parameter);
return ContentService.createTextOutput(JSON.stringify(e.parameter));
}
I can get it working with the /exec string but when I try the /dev string I can't. I'm getting a 500 error. I'm logged into my account and have updated the version number under publish. How can I get this working?
EDIT:
Thank you. I'm trying to option 1. I created a function that logs the oath token:
function getOAuthToken1() {
Logger.log('Current project has ' + ScriptApp.getOAuthToken());
}
I ran it and got the token. Then inserted it into
https://script.google.com/macros/s/ACCESSTOKEN/dev
but posting to this produces:
Sorry, the file you have requested does not exist.
EDIT2:
You want to use doPost() and access to Web Apps with the endpoint of https://script.google.com/macros/s/###/dev.
If my understanding is correct, https://script.google.com/macros/s/ACCESSTOKEN/dev cannot be used as the endpoint. Please use the original endpoint of https://script.google.com/macros/s/###/dev.
As 2 examples for the simple test, when the curl command is used, the sample commands are as follows. You can select one of them and test at your terminal. Both commands use POST method.
curl -L -H "Authorization: Bearer ### access token ###" -d "key=value" "https://script.google.com/macros/s/#####/dev"
or
curl -L -d "key=value" "https://script.google.com/macros/s/#####/dev?access_token=### access token ###"
In order to access to the endpoint of https://script.google.com/macros/s/###/dev of the deployed Web Apps, it is required to use the access token.
Replace ### access token ### to the value retrieved by ScriptApp.getOAuthToken().
Replace https://script.google.com/macros/s/#####/dev to your endpoint retrieved by deploying Web Apps.
I used -d "key=value" for the post method. If you don't want to put the values, please replace to -d "".
Note:
If the error related to the scopes occurs when you test above command, please add the following comment. By this, the scope of https://www.googleapis.com/auth/drive is added.
// DriveApp.getFiles();
After added it, please run the function of getOAuthToken1() again. By this, the access token including the scope can be retrieved.
I am beginner to go language. I have downloaded this project (https://github.com/goadesign/goa-cellar) and ran it in local environement. It works well when I make post,get,list calls using goa-cellar client.
Steps:-
go get github.com:goadesign/goa-cellar.git
goagen bootstrap -d
goa-cellar/design go build
Server:-
Start Server -> /.goa-cellar
Following are the sample requests which works well for me using goa-cellar client:
Client:-
Create a account -> ./cellar-cli create account /cellar/accounts --payload '{"name": "test"}'
List account -> ./cellar-cli list account
Show account -> ./cellar-cli show account /cellar/accounts/1
I want to make above request using curl or via Postman (chrome addon) or browser add on. How can I do it ?
I have tried the following:-
1. Create account
Method: POST
URL:- http://localhost:8082
Request body: {"name": "test"}
Request headers:- Content-Type: application/json
Response:-
{
"code": "not_found",
"status": 404,
"detail": "/"
}
Server log:-
INFO[06-23|19:08:25] started req_id=RQLpC8kzbF-2 POST=/ from=127.0.0.1 ctrl=<unknown> action=<unknown>
INFO[06-23|19:08:25] payload req_id=RQLpC8kzbF-2 raw=null
INFO[06-23|19:08:25] completed req_id=RQLpC8kzbF-2 status=404 error=not_found bytes=47 time=97.542µs
Just make sending data to the right HTTP API endpoint, in your case, instead this /, need use to cellar/accounts (http://localhost:8082/cellar/accounts)
By POST you make saving data and by GET + id - retreive data.
Look at README for detail info for using this project.
We have a situation where we have 2 users, UserA and UserB. I want to transfer all the files and folders of UserB to UserA.
We are using collaborations API to perform this task. But getting following error
{"type":"error","status":404,"code":"not_found","context_info":{"errors":[{"reason":"invalid_parameter","name":"role","message":"Invalid value 'Owner'. 'role' with value 'Owner' not found"}]},"help_url":"http://developers.box.com/docs/#errors","message":"Not Found","request_id":"304354248562a743910984"}
I get a valid response when I pass anything apart from "owner" as role in request. I don't know what is wrong with "owner" role.
Here is the request
POST https://api.box.com/2.0/collaborations/ HTTP/1.1
As-User: 254598270
Authorization: Bearer UPSUE228kXGuDBGzy07G5fGxIrDL1QDj
Content-Type: text/plain; charset=utf-8
Host: api.box.com
Content-Length: 108
Expect: 100-continue
Accept-Encoding: gzip, deflate
{"item":{"id":"5092905410","type":"folder"},"accessible_by":{"id":"254608030","type":"user"},"role":"owner"}
I think the documentation might be wrong. Specifying an "owner" role in a collaboration doesn't really make sense given how collaborations work.
However, the move user's folder endpoint might be what you're looking for. It allows you to move the entire root folder of one user into another user's account. Here's an example cURL request:
curl https://api.box.com/2.0/users/USER_ID/folders/FOLDER_ID \
-H "Authorization: Bearer ACCESS_TOKEN" \
-d '{"owned_by": {"id": "USER_ID"}}' \
-X PUT
Note that only the root folder is supported right now (which is folder ID 0). Fortunately, it looks like that's the folder you're trying to move.
All that's missing is that you must add them as an editor prior to making them an owner.
If you follow https://developer.box.com/guides/folders/single/change-owner/
You will see that transferring ownership actually doesn't require a folder move. It is a very simple two (or three) step process:
Add the new user as a collaborator of role EDITOR
Immediately update that collaboration to the role of OWNER
That's it. Optionally, you now can remove the collaboration of the original owner, who has been downgraded from owner to editor.
Here is my example using the Python SDK:
bc = box.BoxClient() # This is my own client wrapper
owner = bc.get_user(old_owner.lastname)
user_client = bc.get_user_client(owner.id) # Get a user_client for the owner
src_folder = user_client.folder(FOLDER_ID)
target = bc.get_user('new_owner.lastname')
new_collab = src_folder.collaborate(target, CollaborationRole.EDITOR)
updated_collaboration = new_collab.update_info(CollaborationRole.OWNER)
# Now we can remove the original owner as collaborator:
for collab in src_folder.get_collaborations():
target = collab.accessible_by
if target.id == owner.id:
collab.delete()
First of all, my problem is different from this one: Difference between cURL and web browser?
I use my Chrome browser to visit: http://www.walmart.com/search/browse-ng.do?cat_id=1115193_1071967 And then, I view the page source to get like:
<a class="js-product-title" href="/ip/Tide-Simply-Clean-Fresh-Refreshing-Breeze-Liquid-Laundry-Detergent-138-fl-oz/33963161">
However, I didn't find this kind of info from command line:
curl "http://www.walmart.com/search/browse-ng.do?cat_id=1115193_1071967">local.html
Does anyone know why cause the difference? I am using Python scrapy selector to parse the webpage.
You browser can execute JavaScript, which can in turn change the document. Curl will just give you the plain original output and nothing else.
If you turn off JavaScript in the browser and refresh the page, you will see that it looks differently.
In addition to just executing JS as explained in the other answer, your browser does a lot more work to fetch that page from the server that you are overlooking, and the server may be reacting based on that.
Open Chrome, Press F12, Go to the "Network" Tab.
Load the page you want to.
Look for the very first thing that got requested (It should be a document icon, with the url below it, you can also sort by 'Timeline' to find it too)
Right click on the item, choose 'Copy as cURL'
Paste this into notepad and take a look at what your browser sent to fetch that, vs the simple curl command you did.
curl "http://stackoverflow.com/questions/25333342/viewing-page-source-shows-different-html-than-curl" -H "Accept-Encoding: gzip,deflate,sdch" -H "Accept-Language: en-US,en;q=0.8" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -H "Referer: http://stackoverflow.com/questions?page=2&sort=newest" -H "Cookie: <cookies redacted because lulz>" -H "Connection: keep-alive" -H "Cache-Control: max-age=0" --compressed
Things like the language header sent, and the user agent (more or less what browser and OS you are on), even in some cases if it was requested compressed can all cause a server to generate the page differently. This can be just normal reactions (like giving browser specific html to only that browser, cough*ie and opera*) or part of higher level A/B testing on new designs or functionality. Chances are, the content returned to you see at a URL may likely be different for someone else, or even to you using a different browser or tool.
I also have to point out that what you SEE on the page isnt what comes up with view source. The source is what was sent to your browser to render. What you actually see on the page is something after rendering and Javascript have executed. Most browser support some sort of "Inspect" function on the right click menu, I suggest you take a look at pages through that and compare to what shows in view source, It will change your perspective on how the web works.
Don't know if you have found your answer or not. I have a solution. It could be due to the server throwing 301 etc. The code is straight C, so adapt yourself up.
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); // To see what's happening
curl_easy_setopt(curl, CURLOPT_USERAGENT, curlversion); // variable
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); // Optional/toggle
The last option needs to be tested with/without to see the exactness in both browser output and curl's.
Also, see the verbose by issuing a direct Shell command
:~$ curl -v http://myurl > page.html
See the difference. It should help.
To be used in another external script, we need the list of repositories hosted in a git repository server. We have GitWeb also enabled on the server.
Any one know if GitWeb exposes some API through which we can get the list of repositories ? Like GitBlit RPC (http://gitblit.com/rpc.html like https://your.glitblit.url/rpc?req=LIST_REPOSITORIES) ?
Thanks.
No, from what I can see of the gitweb.cgi (from gitweb/gitweb.perl) implementation, there is no RPC API with JSON return messages.
This is only visible through the web page.
In the bottom right corner there is a small button that reads: TXT
You can get the list of projects there, for example:
For sourceware, the gitweb page: https://sourceware.org/git/
The TXT button links here: https://sourceware.org/git/?a=project_index
It should return a list of projects which are basically
<name of the git repository> <owner>
in plain text, perfectly parseable by script.
But if you want JSON, you'd have to convert it with something like this:
$ wget -q -O- "https://sourceware.org/git/?a=project_index" \
| jq -R -n '[ inputs | split(" ")[0:2] | {"project": .[0], "owner": .[1]} ]'