[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Successor to CentOS] AlmaLinux OS server construction/migration service

[Successor to CentOS] AlmaLinux OS server construction/migration service

[For WordPress only] Cloud server “Web Speed”

[For WordPress only] Cloud server “Web Speed”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Reservation system development] EDISONE customization development service

[Reservation system development] EDISONE customization development service

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[Global exclusive service] Beyond's MSP in North America and China

[Global exclusive service] Beyond's MSP in North America and China

[YouTube] Beyond official channel “Biyomaru Channel”

[YouTube] Beyond official channel “Biyomaru Channel”

Effectively utilize Backlog's API

Hello.
I'm Mandai, in charge of Wild on the development team.

At our company, we use backlog as a development tool.
Backlog is a tool that can be used as a repository server for git, subversion, etc., as a progress management tool, to aggregate knowledge in a wiki, to accumulate tasks in assignments, and so on.

I occasionally use the API, but my brain is getting tired and I seem to forget how to use it, so I thought I'd try pasting some code that I can copy and paste.

 

certification

OAuth2.0 is provided, but to be honest I haven't used it.
Since I often use it from batch programs, I have no choice but to request using an API key.

// Get it with curl curl https://xx.backlog.jp/api/v2/users/myself?apiKey=abcdefghijklmn

 

Get it with PHP $response = file_get_contents('https://xxx.backlog.jp/api/v2/users/myself?apiKey=abcdefghijklmn');

 

GET access is easy if you change the subdomain and path.
The most difficult thing is finding which API to use since it has so many functions and the API is well-developed.

 

CRUD processing

Backlog API is RESTful, so it clearly defines HTTP methods for various CRUD operations.

  • If you want to get information, GET
  • For information creation, POST
  • To edit information, PUT or PATCH
  • To delete information, DELETE

Please note that the API endpoints are often the same, so if you use the wrong HTTP method, you may delete important data.
The difference between PUT and PATCH when editing does not mean that you should use one or the other, but the accepted methods are determined by the API, so please check the Backlog API documentation

 

When you want to obtain information

If you want to get information, send it using the GET method.

# Get space information curl https://[subdomain].backlog.jp/api/v2/space?apiKey=[API KEY]

 

When you want to create information

If you want to create information, send it using the POST method.

# Add Wiki page curl -X POST https://[subdomain].backlog.jp/api/v2/wikis?apiKey=[API KEY] -d "projectId=xxx" -d "name=wiki_name" -d " content=hogehoge" # Register a new issue curl -X POST https://[subdomain].backlog.jp/api/v2/issues?apiKey=[API KEY] -d "projectId=xxx" -d "summary=issue_title " -d "issueTypeId=1" -d "priorityId=3" # Get type information # Rewrite subdomain, project ID, API KEY curl https://[subdomain].backlog.jp/api/v2/projects/ [xxx]/issueTypes?apiKey=[API KEY] # Get priority list # Rewrite subdomain and API KEY curl https://[subdomain].backlog.jp/api/v2/priorities?apiKey=[API KEY ]

 

 

When you want to edit information

If you want to edit the information, send it using either POST or PATCH method.
The types of methods vary depending on the API, so please refer to the documentation.

# Update project information # Where projectIdOrKey is specified, either ProjectID or ProjectKey can be specified curl -X PATCH https://[subdomain].backlog.jp/api/v2/projects/[projectIdOrKey]?apiKey= [API KEY] -d "name=changed_name" # Mark notification as read curl -X POST https://[subdomain].backlog.jp/api/v2/notifications/[notification_id]/markAsRead?apiKey=[API KEY ] # Get notification_id curl https://[subdomain].backlog.jp/api/v2/notifications?apiKey=[API KEY]

 

 

When you want to delete information

If you want to delete information, send the DELETE method.
Conversely, if you do not add the DELETE method, it will not be deleted unless there is an intention to delete it (or there is a mistake in the program).

# Delete issue # Either ID or Key can be specified for issueIdOrKey curl -X DELETE https://[subdomain].backlog.jp/api/v2/issues/[issueIdOrKey]?apiKey=[API KEY ]

 

 

A useful tool for checking API operation

Firefox is a useful tool for running APIs.

It's a super major browser app, so I'm sure you're aware of it, but don't you use Chrome all the time?
When I run Backlog's API in Chrome, the results of the API execution are garbled, but since around version 55, it has become impossible to change the character code, so there is no way to improve it.
(Probably because it's not HTML, so no encoding is specified)

On that point, with Firefox, the characters are displayed without any garbled characters, and a mechanism for automatically parsing JSON data has been introduced for some time now, making JSON data much easier to view.

In addition, there are many add-ons and extensions for RESTful APIs in Chrome and Firefox, so development will be faster if you use one that is familiar to you.

These tools are often used for API development, but I still use curl to create shell scripts for test cases, so I can't provide any recommended API browser information.

 

summary

What do you think of this brief summary?

In addition to task management and progress management, you can paste JSON into the Wiki and use it as a DB, use it as a file storage, and use it other than just as a development tool, depending on your ideas.

It is best not to use it in a proper system to exchange information by pasting JSON, but it is useful for storing data when automating work with small shell scripts for personal use.
When performing detailed processing across multiple servers, it is a hassle to change the connection limit to the DB each time, and I think it is easy to use because it is easy to access the API and can be left behind. .

 
That's it.

If you found this article helpful , please give it a like!
1
Loading...
1 vote, average: 1.00 / 11
2,901
X facebook Hatena Bookmark pocket
[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

The person who wrote this article

About the author

Yoichi Bandai

My main job is developing web APIs for social games, but I'm also fortunate to be able to do a lot of other work, including marketing.
Furthermore, my portrait rights in Beyond are treated as CC0 by him.